note 118188 deleted from control-structures.goto by salathe

From: Date: Mon, 21 Sep 2020 14:42:29 +0000
Subject: note 118188 deleted from control-structures.goto by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215277@lists.php.net to get a copy of this message
Note Submitter: ivan dot tc at gmail dot com ---- This works good: <?php goto start; five: echo $i; goto end; start: echo 'I have '; for ($i=0; $i < 10; $i++) { if ($i == 5) { goto five; } } end: echo ' apples'; ?> Output: I have 5 apples. This don't work: <?php goto start; five: echo $i; goto end; start: echo 'I have '; $count(); end: echo ' apples'; $count = function () { for ($i=0; $i < 10; $i++) { if ($i == 5) { goto five; // line 18 } } } ?> PHP Fatal error: 'goto' to undefined label 'five' on line 18

« previous php.notes (#215277) next »