Objectives
Upon completion of this module, you should be able to:
- Store data in variables and constants.
- Output strings to the screen with
echo
. - Interpolate variables in strings.
- Use comments in your PHP code.
- Define your own functions.
- Store and retrieve single and multi-dimensional array data.
- Store and retrieve hash data.
- Code various conditional and looping structures.
- Understand PHP’s scoping rules.
- Use short echos and the PHP alternative syntax.
Conventions
All source code in the notes will be syntax highlighted like so:
<?php
$beers_on_the_wall = 99;
$beers_on_the_wall--; // Take one down, pass it around.
echo $beers_on_the_wall . " bottles of beer on the wall.";
?>
The output obtained by running the source through an interpreter will be displayed in a monospace font on a grey background:
98 bottles of beer on the wall.