Re: Convert An Array

From: Date: Sun, 24 Feb 2002 21:52:15 +0000
Subject: Re: Convert An Array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-86011@lists.php.net to get a copy of this message
http://www.php.net/manual/en/function.array-count-values.php ----- Original Message ----- From: "jtjohnston" <taylorjo@collegesherbrooke.qc.ca> To: <php-general@lists.php.net> Sent: Sunday, February 24, 2002 10:49 PM Subject: [PHP] Convert An Array > 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. > >

« previous php.general (#86011) next »