On Thursday, April 18, 2002, at 11:38 AM, Julio Nobrega Trabalhando
wrote:
> function custom_function()
> {
> if ($error == 0) {
> return true;
> } else {
> return "Error!";
> }
> }
>
> if (custom_function() != "Error!") {
> echo "Success";
> } else {
> echo "Error";
> }
Your way would work perfect except that I simplified the function I
posted, for illustrative purposes -- a mistake, I realize. The returned
error message is actually composed of an imploded array, whose contents
are entirely dependent on the code in the function (basically it varies
depending on circumstances, so I can't write a test for it).
I ended up just performing the checks in the script itself, rather than
in a function, because I was only using a function as a subroutine to
keep my script's switch() statement nice and clean. But in this case,
it just was too much trouble (I was also running into a situation where
I had to deal with a global variable, etc). Since I don't really need
this anywhere else in the script, I don't really even need it to be a
function.
Thanks for your input though, Julio.
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php