note 128623 added to control-structures.switch

From: Date: Mon, 19 Jun 2023 17:14:47 +0000
Subject: note 128623 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-220582@lists.php.net to get a copy of this message
Note that break can be followed by an optional integer, indicating how many additional break contexts to leave when leaving this switch context. Break contexts are switches and loops. "Leaving" means to continue execution following a break context. Note that the datatype used for all case constants in a switch is determined by the first occurrence of a case, so all cases must use the same datatype, integer or string. So, if the first case is case 0: and the second is case 'abc': , then the 'abc' is internally converted to the integer 0. You may find this unexpected. This example would be fixed by changing the first case to case '':. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 98.2.238.89) ---- Manual Page -- https://php.net/manual/en/control-structures.switch.php Edit -- https://main.php.net/note/edit/128623 Del: integrated -- https://main.php.net/note/delete/128623/integrated Del: useless -- https://main.php.net/note/delete/128623/useless Del: bad code -- https://main.php.net/note/delete/128623/bad+code Del: spam -- https://main.php.net/note/delete/128623/spam Del: non-english -- https://main.php.net/note/delete/128623/non-english Del: in docs -- https://main.php.net/note/delete/128623/in+docs Del: other reasons-- https://main.php.net/note/delete/128623 Reject -- https://main.php.net/note/reject/128623 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220582) next »