assigning by reference to a global doesn't work

From: Date: Mon, 07 Feb 2000 04:12:28 +0000
Subject: assigning by reference to a global doesn't work
Groups: php.version4 
Request: Send a blank email to php-version4+get-9891@lists.php.net to get a copy of this message
This script does not work as I would expect... is this appropriate behavior? if I change $bar to $GLOBALS["bar"] it assigns the reference to $bar outside of the function. This is a oversimplified (but that's the way you like it) example of what I am trying to do, except for the fact that I am trying to use objects, but the results are the same. This is latest CVS from February 6, 2000 on RedHat 6.1 Apache 1.3.11 as DSO. <?php $bar = "foo"; function bar($str) { global $bar; $bar = &$str; } foo("bar"); print($bar); // prints foo ?> Thanks in advance! -jade jmeskill@libertydistribution.com

« previous php.version4 (#9891) next »