If this is the expected behavior references suck
| From: | Mike Heath | Date: | Wed, 04 Oct 2000 21:53:54 +0000 |
| Subject: | If this is the expected behavior references suck | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18662@lists.php.net to get a copy of this message | ||
Is this the expected behavior? From reading the documentation shouldn't $a
and $b both point to the same variable and by changing $a shouldn't it also
change $b? ...or is there something wrong with my logic here? I'm using
PHP 4.0.2 compiled statically with Apache 1.3.12 on RedHat 7.0.
<?php
function foo(&$var) {
global $a;
$a = &$var;
}
$b = "Start";
foo($b);
$a = "End";
echo $b; // Shouldn't this echo "End" not "Start"?
?>
Regards,
Mike Heath
EffinityLabs