News:

SMF - Just Installed!

Main Menu

switch

Started by KingSparta, Dec 08, 2023, 01:00 PM

Previous topic - Next topic

KingSparta

<?php
$favcolor = "red";

switch ($favcolor) {
  case "red":
    echo "Your favorite color is red!";
    break;
  case "blue":
    echo "Your favorite color is blue!";
    break;
  case "green":
    echo "Your favorite color is green!";
    break;
  default:
    echo "Your favorite color is neither red, blue, nor green!";
}
?>