Whats the difference between {$var} and $var?

后端 未结 5 1601
日久生厌
日久生厌 2021-01-19 10:15

I would like to know when and why should I use {$var}

echo \"This is a test using {$var}\";

and when (and why) should I use the simple form

5条回答
  •  旧巷少年郎
    2021-01-19 10:38

    You would use the latter when a) not accessing an object or array for the value, and b) no characters follow the variable name that could possibly be interpreted as part of it.

提交回复
热议问题