note 91030 deleted from language.references.pass by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 May 2009 14:58:49 +0000 |
| Subject: | note 91030 deleted from language.references.pass by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155843@lists.php.net to get a copy of this message | ||
Note Submitter: Neil Young
----
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