note 22254 modified in function.array-count-values by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 13:57:24 +0000 |
| Subject: | note 22254 modified in function.array-count-values by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79827@lists.php.net to get a copy of this message | ||
This does not works with objects. If you have an array filled with objects, you can not count them.
Example:
<?php
$myArray = array();
for ($i = 0 ; $i < 10 ; $i++)
{
$myObject = new MyObject();
$myArray[$i] = $myObject;
}
echo (array_count_values($myArray));
?>
This gives you:
Warning: Can only count STRING and INTEGER values...
Found no solution for this yet...
--was--
This does not works with objects. If you have an array filled with objects, you can not count them.
Example:
$myArray = array();
for ($i = 0 ; $i < 10 ; $i++)
{
$myObject = new MyObject();
$myArray[$i] = $myObject;
}
echo (array_count_values($myArray));
This gives you:
Warning: Can only count STRING and INTEGER values...
Found no solution for this yet...
http://php.net/manual/en/function.array-count-values.php