I understand what the following line does but i don’t understand how the brackets are used? I have always used brackets in an if, while and other statements but i have never used them in this fashion.
Are there rules to using them this way, should i not use them in this way? Any help would be appreciated… Thanks
${$key} = $temp;
In that specific case, there is effectively no difference between using brackets and not.
So your code is equivalent to the following:
The brackets are typically used to force PHP to interpolate variables in strings, which isn’t necessary in this case.
Using the brackets is very helpful for reducing ambiguity in a statement using array indices:
As opposed to
The parser will think that you meant
($$array)[0], not$($array[0])