Re: or return problem
| From: | Chris Shiflett | Date: | Wed, 08 Oct 2003 16:20:04 +0000 |
| Subject: | Re: or return problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165473@lists.php.net to get a copy of this message | ||
> The internals developers probably didn't see a need to provide
> support for "return" in conditionals since it can't return a value
> to the conditional.
Ugh. This is the same misconception, again. Let's try some different code:
<?
function foo()
{
echo "foo\n";
}
function bar()
{
return true;
}
bar() or foo();
?>
The return of foo() does not matter. It is not evaluated. I do not understand
why this is still unclear. Consider this:
if (!bar())
{
foo();
}
Does it seem like foo() is involved in the conditional when expressed like
this? I hope not.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp