In PHP, what is the difference between placing the dollar-sign in front or within the curly brackets:
1. $var = 'Hello World!';
2.
3. echo "${var}";
4. echo "{$var}";
I understand what it is (variable parsing within a string), however there is not a clear explanation between these two differences in the PHP Manual.
The way the variable is parsed on line 3 is supposed to be simple syntax, whilst line 4 is supposed to be complex syntax.
On the PHP Manual however, the syntax used on line 3 is only used as an example for complex syntax which is quite confusing?
Upon a few tests it seems that they both parse variables as complex syntax?
If possible could anyone provide an example of when to use each one?
If there is no difference, then which convention is preferred?