Re: or return problem
| From: | Chris Shiflett | Date: | Tue, 07 Oct 2003 18:45:18 +0000 |
| Subject: | Re: or return problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165349@lists.php.net to get a copy of this message | ||
--- Robert Cummings <robert@interjinn.com> wrote:
> > >Directly from the docs:
> > >
> > > http://ca3.php.net/manual/en/function.return.php
> > >
> > >First line:
> > >
> > > "If called from within a function, the return() statement
> > > immediately ends execution of the current function"
> > >
> > >Important concept:
> > >
> > > IMMEDIATELY returns.
> > >
> > >Learn to read.
> >
> > What does that have to do with anything?
>
> 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??
The code in question, I believe, was basically this:
function foo()
{
true or return('foo');
}
Your answer does not address the question as to why this is invalid syntax, but
instead you explain how return works. This is what Leif is questioning, I
believe.
Regardless, a little less hostility would be nice.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp