您可以使用 array_count_values 获取以实例为键、频率为值的数组。然后你需要将数组从高到低排序,保持索引(arsort)这很重要。
所以:
//your array
$concat=array("DARK HORSE,KATY PERRY", "DARK HORSE,KATY PERRY", "WHEN IT RAINS,PARAMORE", "LITHIUM,NIRVANA")
//get all the frequencies
$frequencies = array_count_values($concat);
//make sure to sort it since array_count_values doesn't return a sorted array
arsort($frequencies);
//reset the array because you can't trust keys to get the first element by itself
reset($frequencies);
//get the first key
echo key($frequencies);