sortowanie z zachowaniem kluczy

$servicesIds = [];

foreach ($conflictedData as $key => $singleGroup) {
   uasort($singleGroup, fn($a, $b) => $a->getCreatedAt() > $b->getCreatedAt());
   unset($conflictedData[$key][array_key_first($singleGroup)]);
   $servicesIds[] = array_keys($conflictedData[$key]);
}

return array_merge(...$servicesIds);
Komentarze wyłączone