RE: [PHP] or return problem
| From: | Ford, Mike [LSS] | Date: | Wed, 08 Oct 2003 16:11:46 +0000 |
| Subject: | RE: [PHP] or return problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-165472@lists.php.net to get a copy of this message | ||
On 08 October 2003 16:43, Robert Cummings contributed these pearls of wisdom:
> On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
>> * Thus wrote Chris Shiflett (shiflett@php.net):
>>> --- "Ford, Mike [LSS]" <M.Ford@lmu.ac.uk>"
> <M.Ford@lmu.ac.uk> wrote:
>>>> Firstly, "or", as a Boolean operator requires two operands,
>>>> both of which must have an actual value.
>>>
>>> [snip]
>>>
>>>> statements don't have a value (and can't even be coerced to
>>>> have one), so "return" can't be valid as one of the
>>>> operands to "or".
>>>
>>> Based on yesterday's discussion, this seems to be a very
>>> common misconception. I will try to clear it up.
>>
>> To add this, the 'include' family also accepts this construct:
>>
>> condition or include(file);
>>
>> Which also violates the rule that statments (constructs) dont
>> have return values.
Well, include isn't really just a statement, since "You can take the value of the include
call as you would a normal function." (from http://uk.php.net/manual/en/function.include.php).
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211