Source Code:
(back to article)
<?php $people = [ ['first_name' => 'John', 'last_name' => 'Doe'], ['first_name' => 'Jane', 'last_name' => 'Smith'], ['first_name' => 'Bob', 'last_name' => 'Johnson'] ]; usort($people, function ($a, $b) { return strcmp($a['last_name'], $b['last_name']); }); print_r($people);
Result:
Report an issue