Determining the name of a global variable within a function

From: Date: Fri, 28 Jul 2000 16:27:51 +0000
Subject: Determining the name of a global variable within a function
Groups: php.general 
Request: Send a blank email to php-general+get-8810@lists.php.net to get a copy of this message
I want to write a function that modifies a global array but returns a different value. Is there any way (in PHP3) to determine the global name of a variable passed to the function? for example: function modify_array($array) { /* code to modify $array */ return $someValue; } $foo = array("A", "B", "C"); $bar = modify_array($foo); /* $foo should now be modified */ If I just knew what $foo was called I could use the $GLOBALS array to access it, but $foo may or may not always be named $foo... So how do I determine its name, or is there some other way to modify the global array from within a function? TIA scott scottn@pnx1.com

« previous php.general (#8810) next »