oops ...
I think I got too far from your original question:
yes,
function returnMeFoo($foo=0)
{
if($foo)
return true;
return false;
}
if(returnMeFoo())
echo 'you will not see this echo';
elseif(returnMeFoo(1))
echo 'but if you see this means the function returned as true';
Cheers,
Maxim Maletsky
-----Original Message-----
From: Maxim Maletsky
Sent: Friday, February 16, 2001 2:40 PM
To: 'Jonathan Sharp'; [EMAIL PROTECTED]; 'Jeff Oien'
Subject: RE: [PHP] True || False ?
Yeah, sure you can,
if return is found in function it then exits it.
for example avoiding 'else' statements:
function returnMeFoo($foo=0)
{
if(!$foo)
return "Hey, you forgot to type a number in";
if($foo>5)
return "$foo is bigger then 5";
if($foo<5)
return "$foo is less then 5";
return "Then, logically, $foo *IS* 5";
}
// then call this function as
echo '<P>'.returnMeFoo(4);
echo '<P>'.returnMeFoo(5);
echo '<P>'.returnMeFoo(6);
And see how fun it is!
Cheers,
Maxim Maletsky
-----Original Message-----
From: Jonathan Sharp [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 1:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] True || False ?
How does php handle true and false? Do they act as true booleans?
Can I do?
function foo()
{
return false;
}
Thanks,
-Jonathan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]