reset

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Set the internal pointer of an array to its first element
<?php reset(array|object &$array): mixed
<?php             $key = key($pair);



            $value = reset($pair);



            if (! isset($dictionary[$key])) {

                $dictionary[$key] = [];
<?php     function head($array)

    {

        return reset($array);

    }

}
<?php     public function whereBetween($key, $values)

    {

        return $this->where($key, '>=', reset($values))->where($key, '<=', end($values));

    }
<?php     public function whereNotBetween($key, $values)

    {

        return $this->filter(

            fn ($item) => data_get($item, $key) < reset($values) || data_get($item, $key) > end($values)

        );

    }
<?php             throw new MultipleColumnsSelectedException;

        }



        return reset($record);

    }
<?php             return 0;

        }



        if (! is_array(reset($values))) {

            $values = [$values];

        }
<?php         }



        if (is_null($update)) {

            $update = array_keys(reset($values));

        }



        return $this->toBase()->upsert(
<?php         $name = explode(':', key($relation))[0];



        if (is_string(reset($relation))) {

            $relation = reset($relation);

        }
<?php         $name = explode(':', key($relation))[0];



        if (is_string(reset($relation))) {

            $relation = reset($relation);

        }



        $models->filter(fn ($model) => ! is_null($model) && ! $model->relationLoaded($name))->load($relation);
<?php         if (count($relations) === 0 || $relations === [[]]) {

            return [];

        } elseif (count($relations) === 1) {

            return reset($relations);

        } else {

            return array_intersect(...array_values($relations));

        }
<?php     {

        $value = $dictionary[$key];



        return $type === 'one' ? reset($value) : $this->related->newCollection($value);

    }
<?php             if (isset($dictionary[$key = $this->getDictionaryKey($model->getAttribute($this->localKey))])) {

                $value = $dictionary[$key];

                $model->setRelation(

                    $relation, reset($value)

                );

            }

        }
<?php     {

        $result = (array) $this->first([$column]);



        return count($result) > 0 ? reset($result) : null;

    }
<?php     {

        $result = (array) $this->selectRaw($expression, $bindings)->first();



        return count($result) > 0 ? reset($result) : null;

    }
<?php     {

        $result = (array) $this->sole([$column]);



        return reset($result);

    }