last

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)
<?php             $grammar = $this->query->getQuery()->getGrammar();



            if ($grammar instanceof MySqlGrammar && $grammar->useLegacyGroupLimit($this->query->getQuery())) {

                $column = 'pivot_'.last(explode('.', $column));

            }



            $this->query->groupLimit($value, $column);
<?php     public function qualifySubSelectColumn($column)

    {

        return $this->getRelationName().'.'.last(explode('.', $column));

    }
<?php     public function getMorphType()

    {

        return last(explode('.', $this->morphType));

    }
<?php     protected function whereInMethod(Model $model, $key)

    {

        return $model->getKeyName() === last(explode('.', $key))

                    && in_array($model->getKeyType(), ['int', 'integer'])

                        ? 'whereIntegerInRaw'

                        : 'whereIn';
<?php         $keysToRemove = ['laravel_row'];



        if (is_string($this->groupLimit['column'])) {

            $column = last(explode('.', $this->groupLimit['column']));



            $keysToRemove[] = '@laravel_group := '.$this->grammar->wrap($column);

            $keysToRemove[] = '@laravel_group := '.$this->grammar->wrap('pivot_'.$column);
<?php         $separator = str_contains(strtolower($columnString), ' as ') ? ' as ' : '\.';



        return last(preg_split('~'.$separator.'~i', $columnString));

    }
<?php         $min = $this->parameter(head($having['values']));



        $max = $this->parameter(last($having['values']));



        return $column.' '.$between.' '.$min.' and '.$max;

    }
<?php     protected function compileDeleteWithJoins(Builder $query, $table, $where)

    {

        $alias = last(explode(' as ', $table));



        $joins = $this->compileJoins($query, $query->joins);
<?php             $query->offset = null;

        }



        $column = last(explode('.', $query->groupLimit['column']));

        $column = $this->wrap($column);



        $partition = ', @laravel_row := if(@laravel_group = '.$column.', @laravel_row + 1, 1) as `laravel_row`';
<?php     protected function compileUpdateColumns(Builder $query, array $values)

    {

        return collect($values)->map(function ($value, $key) {

            $column = last(explode('.', $key));



            if ($this->isJsonSelector($key)) {

                return $this->compileJsonUpdateColumn($column, $value);
<?php         $columns = $this->compileUpdateColumns($query, $values);



        $alias = last(preg_split('/\s+as\s+/i', $query->from));



        $selectSql = $this->compileSelect($query->select($alias.'.ctid'));
<?php     {

        $table = $this->wrapTable($query->from);



        $alias = last(preg_split('/\s+as\s+/i', $query->from));



        $selectSql = $this->compileSelect($query->select($alias.'.ctid'));