Thread: If, else and ==
View Single Post
Old 02-15-2008, 10:14 PM   #12 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Who says that empty() is slow and on what grounds? Also, empty does check all sorts of vars and arrays which basic comparison will not do. In the end it's about knowing what method to use for what circumstances.

P.S. The three equals symbols makes sure that the values are IDENTICAL. In other words, the comparison evaluates to TRUE if the left side is equal to the right, and they are both of the same type (string, integer, etc). For example:
PHP Code:
if (== 0.00) {
    echo 
'0 is equal to 0.00';
} else {
    echo 
'0 is not equal to 0.00';
}

if (
=== 0.00) {
    echo 
'and 0 is identical to 0.00';
} else {
    echo 
'but 0 is not identical to 0.00';

Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
ReSpawN (02-15-2008)