Prev | Current Page 146 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

Given the dollar
sign??™s special purpose of identifying a variable, there must be a way to tell the interpreter
to treat it as a normal character should you want to output it to the screen.
Delimiting the dollar sign with a backslash will accomplish this.
CHAPTER 3 ?–  PHP BASICS 73
Identifiers
Identifier is a general term applied to variables, functions, and various other userdefined
objects. There are several properties that PHP identifiers must abide by:
??? An identifier can consist of one or more characters and must begin with a letter
or an underscore. Furthermore, identifiers can consist of only letters, numbers,
underscore characters, and other ASCII characters from 127 through 255.
Table 3-3 shows a few examples of valid and invalid identifiers.
??? Identifiers are case sensitive. Therefore, a variable named $recipe is different
from a variable named $Recipe, $rEciPe, or $recipE.
??? Identifiers can be any length. This is advantageous because it enables a
programmer to accurately describe the identifier??™s purpose via the identifier name.
??? An identifier name can??™t be identical to any of PHP??™s predefined keywords. You
can find a complete list of these keywords in the PHP manual appendix.
Variables
Although variables have been used in numerous examples in this chapter, the concept
has yet to be formally introduced. This section does so, starting with a definition.


Pages:
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158