note 91030 added to language.references.pass
| From: | NeilYoung at osu1 dot php dot net | Date: | Thu, 21 May 2009 14:53:37 +0000 |
| Subject: | note 91030 added to language.references.pass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-155842@lists.php.net to get a copy of this message | ||
To add to what pillepop2003 at yahoo dot de pointed out, in PHP if you call an undefined variable by
reference, the variable is created - for example:
<?php
ini_set('display_errors', true);
ini_set('error_reporting', E_ALL);
function Test(&$val) {
return;
}
var_dump($foo); // Notice: Undefined variable: foo...
// Output: NULL
Test($foo); // No notice
var_dump($foo); // No notice
// Output: NULL
?>
So now $foo exists after the pass by reference even though it didn't exist before and
wasn't set in the function
----
Server IP: 209.41.74.194
Probable Submitter: 64.246.84.86
----
Manual Page -- http://www.php.net/manual/en/language.references.pass.php
Edit -- https://master.php.net/note/edit/91030
Del: integrated -- https://master.php.net/note/delete/91030/integrated
Del: useless -- https://master.php.net/note/delete/91030/useless
Del: bad code -- https://master.php.net/note/delete/91030/bad+code
Del: spam -- https://master.php.net/note/delete/91030/spam
Del: non-english -- https://master.php.net/note/delete/91030/non-english
Del: in docs -- https://master.php.net/note/delete/91030/in+docs
Del: other reasons-- https://master.php.net/note/delete/91030
Reject -- https://master.php.net/note/reject/91030
Search -- https://master.php.net/manage/user-notes.php