note 52853 added to control-structures.switch

From: Date: Sat, 14 May 2005 23:24:40 +0000
Subject: note 52853 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-89440@lists.php.net to get a copy of this message
To clarify, if you put more than one case for the same value into the switch statement, execution will begin at the first instance of the value, and end with the first break encountered. <?php $j = 0; switch($j) { case 0: echo "part one"; break; case 1: //blah blah blah break; case 0: echo "part two"; break; } ?> would output only "part one". In some ways it would seem intuitive that "part onepart two" would get outputted,and in some ways it makes sense as is. ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52853 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52853&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52853&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52853&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52853&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52853&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52853&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89440) next »