Because PHP is a scripting language, so its excessive flexibility, it will lead to ambiguity in parsing, in general, we want to avoid these ambiguities, here to give a small example, friends may wish to see the following code will output what:
"echo" {$var}_$var_ ";
For the above code, the first echo will always output "Worldworld", because it will not parse the $var alone, but parse into $var_, and the latter will parse into Hello_world, that is, we use curly braces to force the change of its priority.
In fact, there is a very classic example, that is, on the array, directly paste code:
There is more than one explanation in the Daijie code, and the PHP interpreter does not know what is right. $c = Array (' d ' = ' e '); echo "{$c}[' d ']"; array[' d '] $c = array (' d ' = ' e '); echo "${c[' d ']}"; E
Above, we use curly braces to change its precedence, and for specific examples there is little explanation. By the way, this article mainly refer to SF, paste the Portal: http://segmentfault.com/q/1010000000120010
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.