By eHow Internet Editor
Rate: (2 Ratings)
Conditional statements are one of the most powerful tools in any programming language because, without them, it would not be possible to control the program flow. Like any other programming language, PHP has a set of conditional statements that allow your code to perform a different action when a condition is or is not met. One of these statements is the switch statement.
switch ($title)
case "E.T":
case "Star Wars":
echo "Sorry, $title is already taken! Please check later";
break;
case "Casablanca":
case "Breakfast at Tiffany's":
echo "Sorry, we don't lend $title.";
break;
default:
echo "$title is available. Would you like to book it?";
switch ($title) {
case "E.T":
case "Star Wars":
echo "Sorry, $title is already taken! Please check later";
break;
case "Casablanca":
case "Breakfast at Tiffany's":
echo "Sorry, we don't lend $title.";
break;
default:
echo "$title is available. Would you like to book it?";
}
eHow Internet Editor