RE: [PHP] GOTO command. Doest it exist?
| From: | JSheble | Date: | Wed, 12 Jun 2002 05:29:15 +0000 |
| Subject: | RE: [PHP] GOTO command. Doest it exist? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101685@lists.php.net to get a copy of this message | ||
I sure hope I'm not going to stir up any trouble, but why exactly would you
need a GOTO statement? Many languages have no such construct because the
ability to use functions or routines makes GOTO statements obsolete. They
are most likley only in VB because it's a legacy thing, but AFAIK C, C++,
and some of the more less known languages such as Clipper, FORCE do not have
GOTO statements. They haven't been missed either.
>>-----Original Message-----
>>From: David Robley [mailto:robleyd@paradise.net.nz]
>>Sent: Tuesday, June 11, 2002 9:32 PM
>>To: php-general@lists.php.net
>>Subject: Re: [PHP] GOTO command. Doest it exist?
>>
>>
>>In article <001901c21190$c2ffc4e0$0100007f@localhost>,
>>hdanaher@earthlink.net says...
>>> Many will tell you that the goto command is extinct. It isn't,
>>it's just
>>> evolved into the function command. What you do now is create a
>>function:
>>>
>>> function some_name($variable,$other_variable,...)
>>> {
>>> some code here;
>>> }
>>>
>>> then, call it using :
>>>
>>> call_user_func('some_name',$variable,$other_variable,...)
>>>
>>> It's just like goto, it goes to a specified code block and then
>>returns to
>>> the line below the call, but takes more typing.
>>> Hope this helps.
>>> Hugh
>>
>>What you have described is more like a gosub.
>>
>>Goto jumps execution to the specified point in the code and
>>continues from
>>there. It does not automatically return to the line after the goto call.
>>
>>--
>>David Robley
>>Temporary Kiwi!
>>
>>Quod subigo farinam
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>---
>>Incoming mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002
>>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002