note 91395 added to control-structures.goto

From: Date: Tue, 09 Jun 2009 18:47:18 +0000
Subject: note 91395 added to control-structures.goto
Groups: php.notes 
Request: Send a blank email to php-notes+get-156635@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 152.14.93.114 ---- Manual Page -- http://www.php.net/manual/en/control-structures.goto.php Edit -- https://master.php.net/note/edit/91395 Del: integrated -- https://master.php.net/note/delete/91395/integrated Del: useless -- https://master.php.net/note/delete/91395/useless Del: bad code -- https://master.php.net/note/delete/91395/bad+code Del: spam -- https://master.php.net/note/delete/91395/spam Del: non-english -- https://master.php.net/note/delete/91395/non-english Del: in docs -- https://master.php.net/note/delete/91395/in+docs Del: other reasons-- https://master.php.net/note/delete/91395 Reject -- https://master.php.net/note/reject/91395 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156635) next »