foreach (array_count_values ($names) as $name=>$count) ---------------------------------------------^^
-----Original Message----- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: Monday, February 25, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Access Array Values? I knew there was areason why I stopped Perling :) THANKS! How do I disassemble its values? How would I foreach? Something like this? foreach (array_count_values ($names) as $name and $count) <-?????????? { echo"<a href=\"search.php?input=".$name."\">".$name."</a> (".$count.")<br>`; } <a href="search.php?input=bill">bill</a> (3)<br> <a href="search.php?input=john">john</a> (3)<br> <a href="search.php?input=mary">mary</a> (4)<br> http://www.php.net/manual/en/function.array-count-values.php talks about how it counts. But how do I access each separate value? John ----------snip----------- $names = array ("john", "mary", "bill", "mary", "bill", "mary", "bill", "john", "bill", "john"); echo"<pre>"; print_r($names); echo"</pre>"; echo"<hr><pre>"; print_r(array_count_values ($names)); echo"</pre>"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php