Simple question really... one that is pretty darn difficult to 'search' the answer too on php.net or here.
Say you do:
$some['thing'] = "BLAH!";
$string = "blah blah blah blah $GLOBALS[some][thing] blah blah";
echo $string;
That has the nasty way of outputting:
"blah blah blah blah Array[thing] blahblah"
Is there a way to reference an array element like that, without pulling it out of the quotes?
ie not:
$string = "blah blah blah blah ".$GLOBALS[some][thing]." blahblah";
Reason is, say you have a database cell of the above string, and you place it into an eval() to parse the PHP code in the data from a table. Well, you have to addslashes before you do that (to make sure any other quotes dont break the eval), and having the database contain ".$GLOBALS[some][thing]." won't work, because its escaped when used in the eval:
$string = addslashes($db[CELL]);
eval("\$string = \"$string\";");
$string = stripslashes($string);
echo $string;
I tried ${GLOBALS[some][thing]} ... fails obviously... but there has GOT to be something that encloses an entire variable reference like that...