note 21520 deleted from control-structures.switch by crell
| From: | crell@php.net | Date: | Mon, 27 Jun 2022 20:57:40 +0000 |
| Subject: | note 21520 deleted from control-structures.switch by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218639@lists.php.net to get a copy of this message | ||
Note Submitter: paz at spiralon dot com
----
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>";
}
?>