By Steve Suehring, Janet Valade

Part of PHP, MySQL, JavaScript & HTML5 All-in-One For Dummies Cheat Sheet

PHP is a scripting language designed specifically for use on the web. It has features to aid you in programming the tasks needed to develop dynamic web applications. This table provides a brief overview of some of the statements you’ll use frequently:

Statement Description
array ( key => value, . . . ); Casts a key and value as an array.
die(message); Stops processing and displays the message.
do { block
} while (condition);
Performs an operation once and then while a condition is still
true.
echo item; Displays item.
for (startingval;
endingval;increment) { block
}
Begins a loop while startingval is less than endingval.
foreach(
$array as $key => $value) { block }
Begins a loop through an array.
function funcname(value,value,. .
.
) { block }
Declares a function.
header(Location: URL); Sends an HTTP header.
if (condition) { block } Begins a conditional block.
elseif (condition) { block } Provides an alternate test in a conditional block.
else { block } Provides a final alternative in a conditional block.
session_start(); Starts or resumes a session.
session_destroy(); Destroys a session (but doesn’t necessarily clear it
completely.)
unset(); Destroys a variable.
while (condition) { block } Creates a loop while a condition is met.