Here's an problem where i have to find the top book and the number of readers for each book in php . The array is something as below
$input=array();
$input[]=array("Harrypotter","John");
$input[]=array("Twilight","Jack");
$input[]=array("Twilight","John");
$input[]=array("Harrypotter","Jack");
$input[]=array("Gonegirl","marion");
$input[]=array("Gonegirl","marion");
$input[]=array("Gonegirl","John");
$input[]=array("Gonegirl","eliza");
i can find the top book by copying the book names onto a separate array say temparray and use the following functions
$temparray = array_count_values($temparray);
arsort($temparray);
but i'm not able to figure out on the logic how to get the number of readers for each book,the reader names may repeat so we have to eliminate the repeated ones .Any quick way to sort the thing would be helpful.