Bug #12533: Reference and global keyword don't work as documented

From: Date: Thu, 02 Aug 2001 14:26:45 +0000
Subject: Bug #12533: Reference and global keyword don't work as documented
Groups: php.dev 
Request: Send a blank email to php-dev+get-61823@lists.php.net to get a copy of this message
From: pmateesc@dynasty.com Operating system: W2k, Linux PHP version: 4.0.6 PHP Bug Type: Scripting Engine problem Bug description: Reference and global keyword don't work as documented <? $a = 1; $b = 2; function Sum() { global $a, $b; $b = &$a; } echo "a=$a b=$b"; ?> I expect echo to output "a=1 b=1" since within Sum I set the variable $b (which refers to global $b) as a reference to $a. However, this works using $GLOBALS instead of the keyword global. -- Edit bug report at: http://bugs.php.net/?id=12533&edit=1

« previous php.dev (#61823) next »