note 29466 deleted from control-structures.switch by betz
| From: | betz@php.net | Date: | Sat, 15 Feb 2003 17:36:58 +0000 |
| Subject: | note 29466 deleted from control-structures.switch by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-44016@lists.php.net to get a copy of this message | ||
Anwser to Bernd Schwägerl "switch does not work 4 strings".
This works with PHP4.3.0.
Exemple :
<?
function bla_or_blu($mystring)
{
switch ($mystring) {
case "bla" : print "ja,ja!";break;
case "blu" : print "nein,nein";break;
default : print "nix";break;
}
}
$mystring = "bla";
echo bla_or_blu($mystring)."<br>\n";
$mystring = "blu";
echo bla_or_blu($mystring)."<br>\n";
$mystring = "bou";
echo bla_or_blu($mystring)."<br>\n";
?>
print in console mode :
Content-type: text/html
X-Powered-By: PHP/4.3.0
ja,ja!<br>
nein,nein<br>
nix<br>