note 114838 added to functions.arguments
| From: | aasasdasdf at yandex dot ru | Date: | Sat, 12 Apr 2014 12:34:24 +0000 |
| Subject: | note 114838 added to functions.arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199253@lists.php.net to get a copy of this message | ||
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)
----
Server IP: 195.54.192.44
Probable Submitter: 109.167.130.165
----
Manual Page -- http://php.net/manual/en/functions.arguments.php
Edit -- https://master.php.net/note/edit/114838
Del: integrated -- https://master.php.net/note/delete/114838/integrated
Del: useless -- https://master.php.net/note/delete/114838/useless
Del: bad code -- https://master.php.net/note/delete/114838/bad+code
Del: spam -- https://master.php.net/note/delete/114838/spam
Del: non-english -- https://master.php.net/note/delete/114838/non-english
Del: in docs -- https://master.php.net/note/delete/114838/in+docs
Del: other reasons-- https://master.php.net/note/delete/114838
Reject -- https://master.php.net/note/reject/114838
Search -- https://master.php.net/manage/user-notes.php