note 91795 added to control-structures.goto

From: Date: Thu, 25 Jun 2009 18:07:24 +0000
Subject: note 91795 added to control-structures.goto
Groups: php.notes 
Request: Send a blank email to php-notes+get-157503@lists.php.net to get a copy of this message
For all the new programmers out there learning PHP, the computer science establishment has a simple rule regarding goto statements. The rule is to not use them. Ever. goto statements become problematic very quickly because using even one can make auditing the path of execution through your script extremely difficult. A much, much better solution is to define logical pieces of work in functions and call them as needed. Programs with goto statements typically devolve rapidly into systems where global variables abound, and random parts of the script have seemingly random and unpredictable side effects on other parts of the script. Kind of like whack-a-mole. A graphical representation of your code with goto statements will look less like a highway system and more like the bumper cars at the state fair. Consider yourself warned. Besides, you don't want to be attacked by dinosaurs, do you? ---- Server IP: 209.41.74.194 Probable Submitter: 75.182.90.156 ---- Manual Page -- http://www.php.net/manual/en/control-structures.goto.php Edit -- https://master.php.net/note/edit/91795 Del: integrated -- https://master.php.net/note/delete/91795/integrated Del: useless -- https://master.php.net/note/delete/91795/useless Del: bad code -- https://master.php.net/note/delete/91795/bad+code Del: spam -- https://master.php.net/note/delete/91795/spam Del: non-english -- https://master.php.net/note/delete/91795/non-english Del: in docs -- https://master.php.net/note/delete/91795/in+docs Del: other reasons-- https://master.php.net/note/delete/91795 Reject -- https://master.php.net/note/reject/91795 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#157503) next »