Use PHP Statements to Create Programs

Part of the PHP & MySQL For Dummies Cheat Sheet

PHP programs are a series of PHP statements, executed one at a time. Here’s a list of the PHP statements (with syntax) that you use when writing PHP programs:

array ( "key" => "value", … );
die("message");
do { block } while (condition);
echo item;
extract($array);
for (startingval; endingval;incremnt) { block }
foreach( $array as $key => $value) { block }
function funcname(value,value,…) { block }
header("Location: URL");
if (condition) { block }
   elseif (condition) { block }
   else { block }
number_format(number,decimals);
session_start();
session_destroy();
switch var { case value statements break; … }
unset();
while (condition) { block }
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus

SERIES
PHP & MySQL For Dummies Cheat Sheet

Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.