exiting/printing in functions
| From: | sean at interconnect dot is dot it | Date: | Tue, 22 Jan 2002 21:06:57 +0000 |
| Subject: | exiting/printing in functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-81595@lists.php.net to get a copy of this message | ||
Hello,
I wanted to run this by you folks to make sure that this won't cause any problems in other
OS'es, and just to ask if this is good php practice.
I have a simple function:
function relocate($action, $html, $url){
if ($action){
print $html;
exit;
}
else {
print Header ("Location:$url");
exit;
}
}
followed by other php stuff (no messing with headers so we can still change location).
And near the end (after we have devised the values of the variables $action, $html and $url) I call
the function.
It just seems strange to have an echo in a function, as well as a redirect, but it suites my needs
perfectly. Is it me being paranoid, or is this actually strange and/or will it give screwy results
in different servers?
Thanks,
Sean
----------------------------------
I N T E R C O N N E C T
Internet Image Development
http://www.InterConnect.is.it
----------------------------------