Skip to content

Instantly share code, notes, and snippets.

@somoza
Created February 3, 2020 21:11
Show Gist options
  • Save somoza/66501f30d09c6ed5f61b0b68080a773e to your computer and use it in GitHub Desktop.
Save somoza/66501f30d09c6ed5f61b0b68080a773e to your computer and use it in GitHub Desktop.
Sort multidimensional array
$response = [
[
'position'=> 1,
'name' => 'Test',
],
[
'position'=> 2,
'name' => 'Test2',
],
]
usort($response, function ($a, $b) { return strcmp($a['position'], $b['position']); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment