RE: [PHP-WIN] Multiple conditions in an if statement
| From: | Vail, Warren | Date: | Fri, 15 Mar 2002 22:20:48 +0000 |
| Subject: | RE: [PHP-WIN] Multiple conditions in an if statement | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-12655@lists.php.net to get a copy of this message | ||
I'd be willing to bet it did not;
I often use;
if(isset($var) && $var != "") xxxxx
second test above would generate error if $var was not valid and the second
test was executed anyway. The key is the && between the two tests, first
one fails, no need to test the second, probably lifted right out of the C
compiler implementation and syntax.
Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658
-----Original Message-----
From: Asendorf, John [mailto:JAsendorf@lcounty.com]
Sent: Friday, March 15, 2002 1:39 PM
To: Php-Windows (E-mail)
Subject: [PHP-WIN] Multiple conditions in an if statement
I have a question about the efficiency of an if statement...
Say you have the following statement,
if ( $i == 6 && eregi ( "foo" , $bar ) ) { }
And the first portion ( $i == 6 ) IS NOT true, does PHP even attempt to run
the regular expression?
Just wondering.
Thanks,
John
---------------------
John Asendorf - jasendorf@lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php