note 86911 modified in control-structures.switch by danbrown

From: Date: Mon, 10 Nov 2008 15:44:28 +0000
Subject: note 86911 modified in control-structures.switch by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146355@lists.php.net to get a copy of this message
Just a word of warning about using switch don't try and compare variables that contain numbers with strings like so: <?php $i=0; switch($i) { case 'TEST': print "Test";break; case 0: print "0";break; } ?> The output will be: Test and not 0. --was-- Just a word of warning about using switch don't try and compare variables that contain numbers with strings like so: $i=0; switch($i) { case 'TEST': print "Test";break; case 0: print "0";break; } The output will be: Test and not 0. http://php.net/manual/en/control-structures.switch.php

« previous php.notes (#146355) next »