note 40888 deleted from control-structures.switch by betz

From: Date: Wed, 29 Mar 2006 02:25:07 +0000
Subject: note 40888 deleted from control-structures.switch by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106897@lists.php.net to get a copy of this message
Note Submitter: Alex Fung ---- I refer to the "Boolean logic does not work inside case statements" example by "design at hyperoptix dot com" at "19-Feb-2004 12:46" I found that his code fragment is working perfectly correct. <?php $x = 18; $y = 6; switch ($x) { case (($y * 4) || (9 * 3)): echo "Member"; break; default: echo "Not a member"; } ?> I don't know what he expects, but the || evaluates to true. Since $8 == true, it echoes "Member". If we set $x=0, then it echoes "Not a member".

« previous php.notes (#106897) next »