RE: [PHP] or return problem
| From: | Robert Cummings | Date: | Tue, 07 Oct 2003 18:44:35 +0000 |
| Subject: | RE: [PHP] or return problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165348@lists.php.net to get a copy of this message | ||
On Tue, 2003-10-07 at 14:40, Roger B.A. Klorese wrote:
> > How can you possibly test, in a conditional, the return value of the
> > return statement itself when it has no value to return and even causes
> > the current scope to exit IMMEDIATELY??
>
> Per the logic, if it returns immediately, isn't the value irrelevant? That
> is, assuming that the truth of the first clause short-circuits evaluation of
> the second one.
Depends on how the return statement is processed since it obviously has
special treatment. But yes, that would be a bug probably if indeed the
the return expression should never be evaluated due to the left operand
evaluating to true. Nonetheless, it's a dirty style for a return IMHO
since if the left operand does evaluate to false then the conditional is
undefined as far as I can tell.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'