note 123835 added to control-structures.goto
| From: | DavidGimenoiAyusoinfo at sima dot cat | Date: | Thu, 09 May 2019 17:43:04 +0000 |
| Subject: | note 123835 added to control-structures.goto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210998@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.130.26 (proxied: 85.48.160.236)
----
Manual Page -- http://php.net/manual/en/control-structures.goto.php
Edit -- https://master.php.net/note/edit/123835
Del: integrated -- https://master.php.net/note/delete/123835/integrated
Del: useless -- https://master.php.net/note/delete/123835/useless
Del: bad code -- https://master.php.net/note/delete/123835/bad+code
Del: spam -- https://master.php.net/note/delete/123835/spam
Del: non-english -- https://master.php.net/note/delete/123835/non-english
Del: in docs -- https://master.php.net/note/delete/123835/in+docs
Del: other reasons-- https://master.php.net/note/delete/123835
Reject -- https://master.php.net/note/reject/123835
Search -- https://master.php.net/manage/user-notes.php