August 2013
Intermediate to advanced
140 pages
1h 49m
English
CHAPTER 28
![]()
Advanced Variables
In addition to being a container for data, PHP variables have some other features that will be examined in this chapter. These are features that are not commonly used but are good to know about.
Curly syntax
A variable name can be explicitly specified by enclosing it in curly brackets. This is known as curly or complex syntax. To illustrate, the following code will output the variable even though it appears in the middle of a word.
$fruit = 'Apple';echo "Two {$fruit}s"; // "Two Apples"
More importantly, the curly syntax is useful for forming variable names out of expressions. Consider the following code which uses ...
Read now
Unlock full access