problem: creating global alias inside function

From: Date: Mon, 28 Jul 2003 14:32:33 +0000
Subject: problem: creating global alias inside function
Groups: php.general 
Request: Send a blank email to php-general+get-157183@lists.php.net to get a copy of this message
The following code illustrates a problem I've got with references (running on PHP 4.3.2). Can anyone explain it for me? Thanks in advance for any assistance! Martin <?php $globalvariable = 0; $one = 1; //want to set up $globalvariable as a reference to $one setglobal($one); echo $globalvariable; //prints 0, not 1 function setglobal(&$one) { global $globalvariable; $globalvariable =& $one; } ?>

« previous php.general (#157183) next »