Forum Moderators: coopster

Message Too Old, No Replies

global 'variable variables' in functions?

help!

         

pixeltierra

7:15 pm on Nov 10, 2006 (gmt 0)

10+ Year Member



Anyone know how to accomplish this? Here is an example:

$a = 'jim';
$jim = 'friend';

function Test(){
global $$a;
echo $a;
}

I want this to echo "friend", the value of $jim. But I can't seem to get it to work. I've also tried

global ${$a}

to no avail.

pixeltierra

7:18 pm on Nov 10, 2006 (gmt 0)

10+ Year Member



Nevermind, it would help if I spelled global right instead of gloabl. As you were...

eelixduppy

8:03 pm on Nov 10, 2006 (gmt 0)



If you have a text editor with syntax highlighting this would have been much easier for you to spot! ;)