note 105713 deleted from function.count by googleguy

From: Date: Mon, 17 Sep 2012 00:07:38 +0000
Subject: note 105713 deleted from function.count by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190822@lists.php.net to get a copy of this message
Note Submitter: mike dot mackintosh at angrystatic dot com ---- If you try to do a sizeof or count with an object, it will always return 1 if the object is not null. You need to type cast the object as an array for it to count correctly. ex: <?php $obj->foo = 'fu'; $obj->bar = $fooBar(); echo count($obj); //returns 1 echo count( (array) $obj); // returns 2 ?>

« previous php.notes (#190822) next »