PHP (1)

Can you explain curly braces around variables in PHP?

I don't quite get curly braces around variables in PHP. Can you explain or show me where to find information on that in the PHP manual?

Look here:
http://www.php.net/manual/en/language.variables.variable.php

Especially pertinent, perhaps, is this part:
"In order to use variable variables with arrays, you have to resolve an ambiguity problem. That is, if you write $$a[1] then the parser needs to know if you meant to use $a[1] as a variable, or if you wanted $$a as the variable and then the [1] index from that variable. The syntax for resolving this ambiguity is: ${$a[1]} for the first case and ${$a}[1] for the second."

Comments

Add a Comment



NOTE: Comments are moderated and will not show until approved.