Skip to content

Instantly share code, notes, and snippets.

@calevano
Created August 19, 2019 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calevano/f82f7f0bde29df809dd93b49b1eb36ff to your computer and use it in GitHub Desktop.
Save calevano/f82f7f0bde29df809dd93b49b1eb36ff to your computer and use it in GitHub Desktop.
Array order to value
$new = [
[
'hashtag' => 'a7e87329b5eab8578f4f1098a152d6f4',
'title' => 'Flower',
'order' => 3,
],
[
'hashtag' => 'b24ce0cd392a5b0b8dedc66c25213594',
'title' => 'Free',
'order' => 2,
],
[
'hashtag' => 'e7d31fc0602fb2ede144d18cdffd816b',
'title' => 'Ready',
'order' => 1,
],
];
$keys = array_column($new, 'order');
array_multisort($keys, SORT_ASC, $new);
var_dump($new);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment