Bug #12533 Updated: Reference and global keyword don't work as documented
| From: | yohgaki@php.net | Date: | Fri, 14 Dec 2001 19:37:42 +0000 |
| Subject: | Bug #12533 Updated: Reference and global keyword don't work as documented | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-73816@lists.php.net to get a copy of this message | ||
ID: 12533
Updated by: yohgaki
Reported By: pmateesc@dynasty.com
Old Status: Open
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: W2k, Linux
PHP Version: 4.0.6
New Comment:
This is explained in the Manual. Please ask support question to php-general.
Note: Reference is not a pointer. This is confiuing, but it will not be fixed.
Previous Comments:
------------------------------------------------------------------------
[2001-08-02 10:26:44] pmateesc@dynasty.com
<?
$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 this bug report at http://bugs.php.net/?id=12533&edit=1