case di php code example
Example 1: case statement in php
<?php
switch ($i) {
case "apple":
echo "i is apple";
break;
case "bar":
echo "i is bar";
break;
case "cake":
echo "i is cake";
break;
}
?>
Example 2: is switch case case sensitive in php
<?php
$smart = "cRikEy";
switch (strtolower($smart)) {
case "crikey": // Note the lowercase chars
echo "Crikey";
break;
case "hund":
echo "Hund";
break;
case "kat":
echo "Kat";
break;
default:
echo "Alt Andet";
}
?>