PHP variable variables in {} symbols -
I get the basics of variable variables, but I have just figured out a syntax, which is a little bit of my brain Will speak.
$ this-> {$ ToShow} ();
I really do not know what those signs are doing there. Do they have any special meaning?
PHP's variable analyzer is not greed {} uses that indicates what part of a variable reference Should be considered and what is not. Consider this:
$ arr = array (); $ Arr [3] = array (); $ Arr [3] [4] = 'Hi there'; Echo "$ arr [3] [4]";
Note the double quotation marks. You were expecting it to be output Hello there
, but in fact you are seeing Ara [4]
because it is the non-redistribution of the parser, it's only a level The array will check the indexing, while the variable will be inserted into the string, then what exactly was seen:
$ arr [echo] [3], "[4]";
But,
echo "{$ arr [3] [4]}";
Forces all braces as a reference in the treatment inside the braces, and you end with the expected Hello there
.
Comments
Post a Comment