Skip to content

Instantly share code, notes, and snippets.

@Ambalus
Created October 22, 2017 10:00
Show Gist options
  • Select an option

  • Save Ambalus/b688feac468cd7c48a1b22313a0f9f79 to your computer and use it in GitHub Desktop.

Select an option

Save Ambalus/b688feac468cd7c48a1b22313a0f9f79 to your computer and use it in GitHub Desktop.
<?php
$source = [
[8064,8064,7920,6863,6768,5616,5347],
['You','Mand','Google O','Link','Google V','Google F','Google B'],
['service5','service3','service1','service6','service2','service4','service7']
];
$result = [];
$ids = $source[0];
$names = $source[1];
for($j=0;$j < count($source[0]);$j++){
$result[$j] = [
'id' => $source[0][$j],
'name' => $source[1][$j],
'service' => $source[2][$j]
];
}
array_multisort($ids, SORT_NUMERIC | SORT_ASC, $names, SORT_STRING | SORT_DESC, $result);
foreach($result as $row){
print implode(' / ',$row)."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment