Forum Moderators: coopster
In JSP, i would use <jsp:forward>, which is basically a "go to" command. The only reference I can find to "transfer of control" in PHP is the header(location: ) function. But that requires a complete server/browser/server interchange.
There must be a more direct way to transfer control in PHP. Would someone please tell me what it is?
Andreas
FYI, I just posted the following to the PHP site for consideration for inclusion in the manual under exit(). What do you think?:
exit -- Output a message and terminate all script execution for this request. (For HTTP requests, this causes the response generated thus far to be sent to the browser.)
Use "return" to terminate the current script only and return to any script that included it (resuming execution at the point after the include).
"exit" can be used immediately following a "require" or "include" to simulate unconditional branching (i.e. "go to") to another script file.
[End of submission]
Return is generally used for ending functions. I think it's ability to act like exit is just a fallback.
Although an alias, die is generally used when an error occurs. A common example would be:
$result = mysql_query ($command, $link_id) or die ("ERROR: Mysql Query failed". mysql_error());
HTH
Allen