note 123835 deleted from control-structures.goto by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:42:34 +0000 |
| Subject: | note 123835 deleted from control-structures.goto by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215279@lists.php.net to get a copy of this message | ||
Note Submitter: David Gimeno i Ayuso info at sima dot cat
----
Goto isn't too advisable but sometimes it's a clearer solution than an if clause with a
large number of instructions inside.
if ($error):
goto ExitFunction;
endif;
... a good bunch of lines ...
ExitFunction:
Anyway, what I would like to comment is maybe a gosub or perform operator will be useful too.
Many times I needed to create a separate function and pass a lot of variables to it just because
there is a set of instructions I need to repeat in some parts of a process or function.