note 9901 deleted from function.count by googleguy

From: Date: Mon, 17 Sep 2012 00:11:18 +0000
Subject: note 9901 deleted from function.count by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190828@lists.php.net to get a copy of this message
Note Submitter: martin at complinet dot com ---- The count function does not ignore null values in an array. To achieve this use this function. <?php function xcount($array) { while (list($key, $value) = each($array)) { if ($value) { $count++; } } return $count; } ?>

« previous php.notes (#190828) next »