$GLOBALS Assignement¶
It is not possible to assign the $GLOBALS
variable anymore. The individual values may still be assigned directly.
PHP code¶
<?php
$GLOBALS['a'] = 1;
$b = &$GLOBALS;
$b = array();
print_r($GLOBALS);
?>
Before¶
Array
(
)
After¶
PHP Fatal error: Cannot acquire reference to $GLOBALS
PHP version change¶
This behavior changed in 8.1