To check how often an equal value is in my array I count them with:
$count = array_count_values($array_names);
To get each key/value pair I use this foreach loop:
foreach ($count as $key => $value) {
echo $value . '–' . $key . '<br />';
}
Possible output:
2 – Harry Peters
1 – Winston Meyers
3 – Jason Williams
Now I’ve got a second array with URLs:
$urls = array(http://harry-peters.com, http://winston-meyers.com, http://jason-williams.com);
That array should be wrapped around the $key variable like
echo $value . '- <a href="' . $url . '">' . $key . '</a><br />';
So I’ll get something like:
2 – <a href="http://harry-peters.com">Harry Peters</a>
1 – <a href="http://winston-meyers.com">Winston Meyers</a>
3 – <a href="http://jason-williams.com">Jason Williams</a>
But I don’t know how to implement another foreach loop for the URLs to the first loop.
Is this useful for you?
Be careful because the urls have to be exactly matching the order of the names.