To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > General Help

General Help Forum for General Help questions pertaining to PHP

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-06-2003, 04:33 PM   #1
mikerh9
Senior Member
 
Join Date: Jul 2003
Posts: 210
goto

I look on the php.net page and coudn't find if PHP has goto ability. I need to use some sort for jump syntax in the code. IF something go to line 1 and and start execute code from line number....

For example
#code
goto line 1;
mikerh9 is offline   Reply With Quote
Old 12-06-2003, 04:44 PM   #2
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
Well, this really should be in the coding forum, not the code critique. Now, the best implementation of this would be to create a function. So instead of telling it goto line whatever, you just tell it to execute the function.
PHP Code:
function doThis() {
   echo
"Blah";
}

if(
$whatever) {
   
doThis();
}
LordShryku is offline   Reply With Quote
Old 12-06-2003, 05:29 PM   #3
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Actually creating a function is php version of goto to or gosub in basic (E.g. im talking more to QBasic as its the only basic language i know).
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 12-06-2003, 09:55 PM   #4
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,126
Urg. Goto. You know when that command was invented it was actually intended for exception handling?

Quote:
Go To Statement Considered Harmful
Guiseppe Jacopini seems to have proved the (logical) superfluousness of the go to statement. The exercise to translate an arbitrary flow diagram more or less mechanically into a jump-less one, however, is not to be recommended. Then the resulting flow diagram cannot be expected to be more transparent than the original one.
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
Weedpacket is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 11:12 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.