Hi,
I would like to access an array via an index I have in a string. I know I
can pull the string apart and manually access it but that just looks ugly to
me :)
$pg['owner']['email'] = "fo*@bar.com";
$row->name = "[owner][name]"; //single quotes on 'owner' haven't helped
$value = "pg".$row->name;
echo $value; //ouput: 'pg[owner][email]'
echo $$value; //ouput: '' //not what i want!
eval ("\$value = $$value;");
echo $value; //output: 'fo*@bar.com' //what i want
Now i've tried lots of ${ } stuff but I'm at a loss - why does the eval ()
code work but not the real code!!!
Cheers
--
Kyle Maddison
km**********@cam.ac.uk
http://kyle.is-a-geek.com/