Thread: If, else and ==
View Single Post
Old 02-15-2008, 07:58 PM   #11 (permalink)
ReSpawN
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

Quote:
Originally Posted by xenon View Post
Because empty doesn't check only if the argument is 0 (zero), it checks for other empty values, as well. This would be the rewriting of the empty function:

Code:
function custom_empty( $val )
{
    if( $val === '' ||
        $val === 0 ||
        $val === '0' ||
        $val === null ||
        $val === false ||
        $val === array() )
    {
        return true;
    }
    
    return false;
}
So...why is it a so 'tremendous slow function'?
I did not mean the == (why 3?) operator was slow, I meant empty() was slow. And next to that, like you said, it doesn't check all sorts of vars and arrays. You can check if the var contains something but it won't work on an array.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote