Logically the if-else construct is faster becuase PHP doesn't have to parse
and execute the second conditional.  An if-elseif construct is ussually
followed by an else block to describe a default action if no other
conditions are true.  Otherwise you may as well use sequential if()
statements becuase it's exactly the same thing.
- Kevin

----- Original Message -----
From: "Liam Gibbs" <[EMAIL PROTECTED]>
To: "php list" <[EMAIL PROTECTED]>
Sent: Tuesday, March 18, 2003 1:02 PM
Subject: [PHP] Which is quicker, if-else statements


Is it just as quick to do:

if($r == 0) {
} else if($r != 0) {
}

than to do:

if($r == 0) {
} else {
}

The reason I like the former method is because, in a large IF-ELSE block,
it's clear what belongs to what IF and what's going on. But does this make
it lag? And, if so, is it really all that noticeable?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to