The last function returns the last element in the given array:
<?php $array = [100, 200, 300];

$last = last($array);
<?php             foreach ($middlewares as $finisher) {

                if ($finisher === null) continue;



                $finisher = is_array($finisher) ? last($finisher) : $finisher;



                $result = $finisher($forward, ...$extras);
<?php     public function extractOriginalNameFromFilePath($path)

    {

        return base64_decode(head(explode('-', last(explode('-meta', str($path)->replace('_', '/'))))));

    }



    public static function createFromLivewire($filePath)
<?php     function current()

    {

        return last(app(HandleComponents::class)::$componentStack);

    }



    function update($snapshot, $diff, $calls)