note 9901 modified in function.count by vrana

From: Date: Tue, 17 Aug 2004 14:55:44 +0000
Subject: note 9901 modified in function.count by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79745@lists.php.net to get a copy of this message
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; } ?> --was-- The count function does not ignore null values in an array. To achieve this use this function. function xcount($array) { while (list($key, $value) = each($array)) { if ($value) { $count++; } } return $count; } http://php.net/manual/en/function.count.php

« previous php.notes (#79745) next »