note 25310 deleted from control-structures.break by nlopess
| From: | nlopess@php.net | Date: | Sat, 27 Dec 2003 11:52:06 +0000 |
| Subject: | note 25310 deleted from control-structures.break by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62546@lists.php.net to get a copy of this message | ||
Note Submitter: hellkeeper_1@hotmail.com
----
HELLo!
After some scratching and testing I realised that this will not work on included pages, to return
back to the original page you _have_ to "return".
Let me illustrate with an example:
/*********************
<?PHP // Some page
function main () {
/* */ switch ($Test) {
/* - - -*/ case 1:
/* - - - - - */ include "test.php";
/* */ }
}
?>
<?PHP // test.php
if (false) {
/* */ return false;
}
?>
*********************/
This will correctly skip out of the last file, and end up in the "main ()" function. Take
note that this will _not_ exit out of the function in which the file was included ("main
()" in this case), but "return ()" relates to the "include ()" construct.
PS: Sorry for the strange comments at the beginning of the lines, but I miss the <PRE> tag.
:-(
Happy codin'!