note 91395 deleted from control-structures.goto by danbrown
| From: | danbrown@php.net | Date: | Tue, 09 Jun 2009 18:49:01 +0000 |
| Subject: | note 91395 deleted from control-structures.goto by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156636@lists.php.net to get a copy of this message | ||
Note Submitter: Tyler Bletsch
----
You should almost never, ever use this. The only even remotely plausible use of goto in a modern
language is to have post-error cleanup code at the end of a function that you'd like to reach
from multiple points (like you might see in the Linux kernel). Even so, the number of times where
this use of goto is better or more readable than a traditional if statement is vanishingly small.
If you're coming to PHP from a very old language like GW-BASIC or FORTRAN and you are tempted
to use "goto", stop now. Programming has come a long way since then, and you'll
thank yourself later if you take the time to learn the control flow paradigm used in almost all
contemporary programming languages.