In this tutorial, We will learn how to Arr::sort method sorts an array its values.


Example:

<?php

namespace App\Http\Controllers;
use Illuminate\Support\Arr;

class HomeController extends Controller {

   
    public function index() {
       
        $arr = ['php', 'laravel', 'html', 'css'];
        $sorted2 = Arr::sort($arr);
        print_r($sorted2);//['css','html', 'laravel', 'php']
        
    }

}


Output:

['css','html', 'laravel', 'php']

Thanks, May this example will help you.