note 116436 added to control-structures.switch

From: Date: Fri, 02 Jan 2015 14:03:47 +0000
Subject: note 116436 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-201345@lists.php.net to get a copy of this message
Wouldn't it be simpler if "else" statement had the same effect as "default" case in switch statements? Like this: <?php $i = 6; switch ($i) { case 2: echo "i is 2"; case 3: echo "i is 3"; else: echo "wrong input or whatever. Enter number 2, or 3."; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 141.136.226.45 ---- Manual Page -- http://php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/116436 Del: integrated -- https://master.php.net/note/delete/116436/integrated Del: useless -- https://master.php.net/note/delete/116436/useless Del: bad code -- https://master.php.net/note/delete/116436/bad+code Del: spam -- https://master.php.net/note/delete/116436/spam Del: non-english -- https://master.php.net/note/delete/116436/non-english Del: in docs -- https://master.php.net/note/delete/116436/in+docs Del: other reasons-- https://master.php.net/note/delete/116436 Reject -- https://master.php.net/note/reject/116436 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201345) next »