Inconsistency redesign

From: Date: Wed, 13 Jan 2010 13:36:36 +0000
Subject: Inconsistency redesign
Groups: php.internals 
Request: Send a blank email to internals+get-46685@lists.php.net to get a copy of this message
Hi, I came across this: echo sizeof(array()); echo sizeof(""); $a = ""; var_dump( empty($a)); $a = array(); var_dump(empty($a)); So funny! How something can have a size greater than 0 but still be empty? I think PHP is reinventing the inconsistency word. But then let assume that empty is just making a cast in array. $a = ""; empty($a) //true empty((array)$a) //false Ok so empty is big ugly switch case on type. empty(0); //true empty(45); //false Wooow reinventing emptiness on number.... -- Mathieu Suen

« previous php.internals (#46685) next »