note 29424 rejected from control-structures.switch by betz

From: Date: Sat, 15 Feb 2003 17:36:43 +0000
Subject: note 29424 rejected from control-structures.switch by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-44015@lists.php.net to get a copy of this message
switch does not work 4 strings - same procedure as C or C++. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! switch ($mystring) { case "bla" : print "ja,ja!";break; case "blu" : print "nein,nein";break; default : print "nix";break; } It does not matter if $mystring is "blu" or "bla" - it will print "ja,ja!". Your asking yourself, Y the example mentioned above works? (first,second,third) - the explaination is simple - the INTEGER value of the strings - (the skalar points to) are different!!!!! BUT DO NOT USE SWITCH 4 STRINGS!!!!

« previous php.notes (#44015) next »