note 13706 added to control-structures.switch.php

From: Date: Fri, 29 Jun 2001 15:14:36 +0000
Subject: note 13706 added to control-structures.switch.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14746@lists.php.net to get a copy of this message
It's obvious, but might still bear explicit mention that you can conditionally execute the BREAK statement in order to allow a CASE to fall through to the next CASE. e.g.:-> Here, CASE 1 will fall through and the DEFAULT CASE statements will also be executed unless $somevar is true. switch ($i) { case 0: print "i equals 0"; break; case 1: print "i equals 1"; if ($somevar) { break; } default; echo 'Some Default Statements'; break; } Cheers, Ben Nardone http://www.php.net/manual/en/control-structures.switch.php

« previous php.notes (#14746) next »