note 21520 modified in control-structures.switch by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 13:54:50 +0000 |
| Subject: | note 21520 modified in control-structures.switch by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80016@lists.php.net to get a copy of this message | ||
In case : ) it helps someone, I was able to clean up some hairball code by using nested switches
(didn't see it mentioned here). Thanks to all those who are writing examples - I love this
site!
<?php
$string_match="second";
switch ($string_match) {
case "first":
case "second":
case "third":
print "<H3>Something for all three</H3><br>";
switch ($string_match) {
case "first":
print "something for first only";
break;
case "second":
case "third":
print "something for the other two";
break;
}
break;
default:
print "<H3>no match</H3>";
}
?>
--was--
In case : ) it helps someone, I was able to clean up some hairball code by using nested switches
(didn't see it mentioned here). Thanks to all those who are writing examples - I love this
site!
$string_match="second";
switch ($string_match) {
case "first":
case "second":
case "third":
print "<H3>Something for all three</H3><br>";
switch ($string_match) {
case "first":
print "something for first only";
break;
case "second":
case "third":
print "something for the other two";
break;
}
break;
default:
print "<H3>no match</H3>";
}
http://php.net/manual/en/control-structures.switch.php