Convert An Array
| From: | jtjohnston | Date: | Sun, 24 Feb 2002 21:49:51 +0000 |
| Subject: | Convert An Array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-86010@lists.php.net to get a copy of this message | ||
http://ccl.flsh.usherb.ca/db/authors_under_study.php
or
$names = array ("john", "mary", "bill", "mary",
"bill", "mary", "bill",
"john", "bill", "john");
1) How do I count the elements of $names to produce:
bill 4
john 3
mary 3
2) How do I store the counted elements into a new array? How do I create
this:
$new_array = array ("bill"=>4, "john"=>3, "mary"=>3)
I'm looking at http://www.php.net/manual/en/function.array.php
but not sure.