note 10564 added to Spotting References
| From: | s dot meudec at nexcom dot fr | Date: | Wed, 10 Jan 2001 16:25:14 +0000 |
| Subject: | note 10564 added to Spotting References | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9565@lists.php.net to get a copy of this message | ||
/* in the example below, the reference is lost after the function call, because of the global
declaration in the function (or the declaration in global scope ?) :
*/
global $AA, $BB;
$AA = new stdClass;
$AA->Desc = 'the description';
$BB = 'a string';
echo var_dump($AA);
echo '<br>';
echo var_dump($BB);
echo '<hr>';
function foo()
{
global $AA, $BB;
$BB =& $AA;
echo 'foo:';
echo var_dump($AA);
echo '<br>';
echo var_dump($BB);
echo '<hr>';
}
foo();
echo var_dump($AA);
echo '<br>';
echo var_dump($BB);
echo '<hr>';
http://www.php.net/manual/language.references.spot.php