home

CONDITIONAL STATEMENTS Using SWITCH Tutorial


SWITCH statements can be used instead of multiple IF-ELSE statements checking for the same condition.

<?php #switch.php
   $test = 3;

switch($test) { case 1: echo "this is case 1"; break; case 2: echo "this is case 2"; break; case 3: echo "this is case 3"; break; default: //use default for all other cases echo "No value specified for test var"; break; } ?>

Click here to read about arrays.


Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Copyright © 2014 by Cramerz.com.