Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

No Dynamic Global Variables

Dynamic global variables were possible. This means that a variable, whose name is stored in another variable, could be dynamically used with the global keyword.

These notations are now dropped, in PHP 7.0, except for with the $\{ \} operator.

PHP code

<?php

// Valid in all PHP versions
global $normalGlobal;

// Forbidden in PHP 7
global $$variable->global ;

// Tolerated in PHP 7
global $\{$variable->global\}; 

?>

Before

1

After

PHP Parse error:  syntax error, unexpected token "->", expecting "," or ";" 

Parse error: syntax error, unexpected token "->", expecting "," or ";" 

PHP version change

This behavior changed in 5.6.

Error Messages

Extension

© 2023-2026, Damien Seguy - Exakat