note 114838 deleted from functions.arguments by cmb
| From: | cmb@php.net | Date: | Sun, 10 Nov 2019 13:21:43 +0000 |
| Subject: | note 114838 deleted from functions.arguments by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213031@lists.php.net to get a copy of this message | ||
Note Submitter: aasasdasdf at yandex dot ru
----
As of PHP 5.5.10, it seems that a variable will be separated from its value if defined right in a
function call:
php > error_reporting(E_ALL);
php > function a(&$b) {$b = 1;}
php > a($q = 2); var_dump($q);
Strict Standards: Only variables should be passed by reference in php shell code on line 1
int(2)
php > $w = 3; a($w); var_dump($w);
int(1)
Notice that it's still fine to use a variable that is not defined at all:
php > a($e); var_dump($e);
int(1)