note 109050 deleted from control-structures.break by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:54:04 +0000 |
| Subject: | note 109050 deleted from control-structures.break by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215366@lists.php.net to get a copy of this message | ||
Note Submitter: steve at electricpocket dot com
----
A break statement that is in the outer part of a program (e.g. not in a control loop) will end the
script. This caught me out when I mistakenly had a break in an if statement
i.e.
<?php
echo "hello";
if (true) break;
echo " world";
?>
will only show "hello"