View Single Post
  #40  
Old 09-14-2009, 09:18 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Gambet View Post
According to Stefan, it's similar to how it works when you check boolean values.

This:

PHP Code:
function onCreated() {
  
temp.bool true;
  if (
bool == true) {
    
//Stuff
  
}

Is supposed to take longer to process than this:

PHP Code:
function onCreated() {
  
temp.bool true;
  if (bool) {
    
//Stuff
  
}

This is, in fact, because an if () statement is eventually evaluating down to true.
PHP Code:
if (bool) 
... is saying "Is bool true?", whereas
PHP Code:
if (bool == true
... is saying "Is bool == true true?" (two evaluations instead of one). The difference is not huge though and it is not worth complaining about.
__________________
Skyld
Reply With Quote