На данный момент у меня есть такой код:
Код: Выделить всё
$associativeArray = array("Ripe Mango"=>"Yellow", "Strawberry"=>"Red", "Lemon"=>"Yellow");
groupByColor($associativeArray);
function groupByColor($groupedArray)
{
return $groupedArray;
}
Код: Выделить всё
["Yellow"=>["Ripe Mango", "Lemon"], "Red"=>["Strawberry"]]
Подробнее здесь: https://stackoverflow.com/questions/481 ... as-new-val