RE: [PHP] if statement help
| From: | Ford, Mike | Date: | Fri, 04 Nov 2005 14:38:58 +0000 |
| Subject: | RE: [PHP] if statement help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-225093@lists.php.net to get a copy of this message | ||
On 03 November 2005 15:26, Brent Baisley wrote:
> You only need one "if". The parenthesis will evaluation order.
>
> if( ( !empty( $var1 ) || ( !empty( $var2 ) && !empty( $var3 ) ) ||
> $var1 == "something" )
However, the $var1=="something" test is redundant in this, since if that is true the
!empty($var1) test will also be true and the rest of the test will not be evaluated.
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm