I'm looking for a good way to sort an array by the repeating elements. In other words if this is my array:
$myArray = array("0" => "Jon", "1" => "Bill", "2" => "Bill", "3" => "Bill")
I want to sort this by the elements that is present the most amount of times in the array to the elements that are in the least amount of times.
Want to end up with:
$myArray = array("0" => "Bill", "1" => "Bill", "2" => "Bill", "3" => "Jon")
Because "Bill" appears three times, and Jon only once, I want to put all the "Bill" elements ahead of "Jon".
Basically, put the elements that occur more often in the array at the beginning, based on the number of times it appears in the array.
Understand?