note 29466 added to control-structures.switch

From: Date: Fri, 14 Feb 2003 10:33:39 +0000
Subject: note 29466 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-43927@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> -- http://www.php.net/manual/en/control-structures.switch.php http://master.php.net/manage/user-notes.php?action=edit+29466 http://master.php.net/manage/user-notes.php?action=delete+29466 http://master.php.net/manage/user-notes.php?action=reject+29466

« previous php.notes (#43927) next »