PHP switch

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.