August 2016
Intermediate to advanced
610 pages
11h 55m
English
In PHP 5, expressions on the right side of an assignment operation were parsed right-to-left. In PHP 7, parsing is consistently left-to-right.
$$foo is interpreted as ${$bar}. The final return value is thus the value of $bar instead of the direct value of $foo (which would be bar):$foo = 'bar'; $bar = 'baz'; echo $$foo; // returns 'baz';
$$foo, which references a multi-dimensional array with a bar key and a baz sub-key:$foo = 'bar'; $bar = ['bar' => ['baz' => 'bat']]; // returns 'bat' echo $$foo['bar']['baz'];
Read now
Unlock full access