note 97701 added to control-structures.switch

From: Date: Tue, 04 May 2010 03:09:20 +0000
Subject: note 97701 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-168901@lists.php.net to get a copy of this message
Hi, A simple illustration, I had to re-read the documentation to get it :P $var = 0; switch ($var) { case ($var == 1 || $var == -1): echo 'Its 1 or -1; break; default: echo 'Its NOT 1 or -1'; break; } Output: Its 1 or -1 $var = 0; switch ($var) { case -1: case 1: echo 'Its 1 or -1; break; default: echo 'Its NOT 1 or -1'; break; } Output: Its NOT 1 or -1 ---- Server IP: 69.147.83.197 Probable Submitter: 66.45.240.66 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/97701 Del: integrated -- https://master.php.net/note/delete/97701/integrated Del: useless -- https://master.php.net/note/delete/97701/useless Del: bad code -- https://master.php.net/note/delete/97701/bad+code Del: spam -- https://master.php.net/note/delete/97701/spam Del: non-english -- https://master.php.net/note/delete/97701/non-english Del: in docs -- https://master.php.net/note/delete/97701/in+docs Del: other reasons-- https://master.php.net/note/delete/97701 Reject -- https://master.php.net/note/reject/97701 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168901) next »