Changes

Jump to: navigation, search

An Introduction to PHP Variables

59 bytes added, 16:45, 25 May 2007
Accessing PHP Variable Values
What we are looking for in this scenario is output as follows:
<tt>The Circle is the $numberOfShapesth 6th shape.</tt>
Unfortunately PHP will see the ''th'' on the end of the $numberOfShapes variable name as being part of the name. It will then try to output the value of a variable called $numberOfShapesth, which does not exist. This result in nothing being displayed for this variable:
<tt>The Circle is the shape.</tt>
Fortunately we can get around this issue by placing braces ({ and }) around the variable name to distinguish the name from any other trailing characters:
?>
</pre>
 
To give us the desired output:
 
<tt>The Circle is the 6th shape.</tt>

Navigation menu