RE: [PHP] GOTO command. Doest it exist?

From: Date: Wed, 12 Jun 2002 00:22:30 +0000
Subject: RE: [PHP] GOTO command. Doest it exist?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101650@lists.php.net to get a copy of this message
There are times where a GOTO is really the most efficient way to get out of a deeply nested set of loops or switches where the overhead of adding the additional checks at each level would be painful. There are 1125 gotos in the PHP C code. But, PHP has multi-level breaks to get around this situation. -Rasmus On Wed, 12 Jun 2002, Martin Towell wrote: > I've found that any language that supports "while", "do/while", > "for" and > "if/else" as well as functions/subroutines doesn't need "goto". > > IMO, you should be able to do code using just those basic elements > (sequence, loops, conditions -> basic flowchart "commands") > > just my 2c worth > > -----Original Message----- > From: David Freeman [mailto:dfreeman@outbackqld.net.au] > Sent: Wednesday, June 12, 2002 8:34 AM > To: php-general@lists.php.net > Subject: RE: [PHP] GOTO command. Doest it exist? > > > > > I do beg your pardon... But does PHP not have GOTO command? > > Why do you need one? In my experience, going right back to BASIC over > 10 years ago, it's rarely _necessary_ to have a goto. > > In php I suspect you'd get similar functionlity out of either include() > for creating functions. > > Not using goto tends to promote readability of program flow also, always > a good thing imho. > > Each programming language is different and each has it's own advantage, > disadvantages and is particularly suited to certain uses. A good > programmer works with the tools available rather than worrying over > language differences. Just my own opinion and I don't really expect > anyone else to agree. > > CYA, Dave > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#101650) next »