I searched around this, but found only things in the lines "here's a trick that works", but never an explanation.
In the following code:
error_reporting(-1); ini_set("display_errors", 1); end(array_flip($_GET)); end((array_flip($_GET)));
the first call to end() results in a notification:
Strict standards: only variables should be passed by reference in /home/john/www/test/dp.php on line 3
The following, with array_flip($_GET) enclosed in () , does not cause any complaints.
I understand the reason for the notification, what are the strict standards, what does "pass by reference" mean, and that end() takes an array reference as its argument. (This should, as it affects the original.) My concern is why this works. Make environment () create a temporary variable, or will it just trick the PHP parser in some way? If it creates a temporary variable (and does it by design), then it should be safe to use, but if it is hacked to trick the parser, then it will probably break in future versions of PHP. (I happen to be in PHP version 5.4.36-0 + deb7u1)
Note that I'm not sure that I like this design, even if it is safe (it is easy to not see it, and other people may not know why it is there), but it is often convenient and easy to read when functions can be pulled by the following way.
php
Slashback
source share