Answers for "array_sort in laravel"

PHP
0

array_sort in laravel

$array = [
    ['name' => 'Desk'],
    ['name' => 'Chair'],
];

$array = array_values(array_sort($array, function ($value) {
    return $value['name'];
}));

/*
    [
        ['name' => 'Chair'],
        ['name' => 'Desk'],
    ]
*/
Posted by: Guest on June-12-2021

Code answers related to "array_sort in laravel"

Browse Popular Code Answers by Language