Keywords In Namespace¶
PHP didn’t accept its own keywords in the definition of a namespace. Nowadays, namespaces are parsed as a whole, and there are no keywords in there. Before, the namespaces were parsed bit by bit, and the presence of the keywords was an impediment in that process.
PHP code¶
<?php
namespace a\eval\b;
echo __NAMESPACE__;
?>
Before¶
syntax error, unexpected token "\", expecting "{"
After¶
a\eval\b
PHP version change¶
This behavior changed in 8.0