--- Robert Cummings <[EMAIL PROTECTED]> wrote:
> The original post came from someone being lazy, that appears to be
> influencing my take on the thread :)
Understandable. :-)
> Also given the above code, it's completely pointless since the first
> operand is true and so it is impossible for return( 'foo' ) to ever
> be evaluated
I don't think that was the point. You can rewrite it like this if you like:
function foo()
{
false or return 'foo';
}
I believe the original poster mentioned being lazy to justify why this code is
not used instead:
function foo()
{
if (!false)
{
return 'foo';
}
}
The conditional expression itself is irrelevant. This is a question about the
language construct.
> I think anyone coding a return in a conditional like that is asking
> for trouble since I would guess that it has an undefined return
> value.
Well, anyone who tries that code will get a parse error, so that is definitely
an invitation for trouble. The return value would be defined if this worked as
I think it the original poster indended. The 'or' is not a typical conditional
statement, by the way, otherwise this would work just fine.
Hope that helps.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php