PHP equivalent of goto?
Moderator: General Moderators
PHP equivalent of goto?
Dear All
I've tried my usual Google lookup of 'PHP <command>', but I can't seem to find anything on 'goto'. Normally in a C++-esque language goto is a standard feature. I need it for my current program!
Can anyone tell me the equivalent?
Many thanks
Mark
I've tried my usual Google lookup of 'PHP <command>', but I can't seem to find anything on 'goto'. Normally in a C++-esque language goto is a standard feature. I need it for my current program!
Can anyone tell me the equivalent?
Many thanks
Mark
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
or you can pass it to the function i.e.
Because, anyways, you don't want spaghetti code do you?
Code: Select all
<?php
function whereFrom($uri){
echo "I came from ".$uri;
}
whereFrom($_SERVER['REQUEST_URI'] );
?>-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
mjseaden - just use this:
that'll work as is, no worry about spaghettification 
Code: Select all
global $_SERVER;
echo $_SERVER["REQUEST_URI"];- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
no need to $_SERVER is already a superglobal... 
Code: Select all
global $_SERVER;- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact: