Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Shift an element off the beginning of array
<?php array_shift(array &$array): mixed
<?php $arguments = func_get_args();
$user = array_shift($arguments);
$result = $this->callPolicyBefore(
$policy, $user, $ability, $arguments
<?php if (isset($arguments[0]) && is_string($arguments[0])) {
array_shift($arguments);
}
if (! is_callable([$policy, $method])) {
<?php protected function attachRemainderOfChainToEndOfBatch(PendingBatch $batch)
{
if (! empty($this->chained)) {
$next = unserialize(array_shift($this->chained));
$next->chained = $this->chained;
<?php public function dispatchNextJobInChain()
{
if (! empty($this->chained)) {
dispatch(tap(unserialize(array_shift($this->chained)), function ($next) {
$next->chained = $this->chained;
$next->onConnection($next->connection ?: $this->chainConnection);
<?php $array = &$original;
while (count($parts) > 1) {
$part = array_shift($parts);
if (isset($array[$part]) && static::accessible($array[$part])) {
$array = &$array[$part];
<?php }
}
unset($array[array_shift($parts)]);
}
}
<?php $array = &$array[$key];
}
$array[array_shift($keys)] = $value;
return $array;
}
<?php if (! $this->useAsCallable($groupBy) && is_array($groupBy)) {
$nextGroups = $groupBy;
$groupBy = array_shift($nextGroups);
}
$groupBy = $this->valueRetriever($groupBy);
<?php public function shift($count = 1)
{
if ($count === 1) {
return array_shift($this->items);
}
if ($this->isEmpty()) {
<?php $collectionCount = $this->count();
foreach (range(1, min($count, $collectionCount)) as $item) {
array_push($results, array_shift($this->items));
}
return new static($results);
<?php {
$segments = is_array($key) ? $key : explode('.', $key);
if (($segment = array_shift($segments)) === '*') {
if (! Arr::accessible($target)) {
$target = [];
}
<?php {
$segments = is_array($key) ? $key : explode('.', $key);
if (($segment = array_shift($segments)) === '*' && Arr::accessible($target)) {
if ($segments) {
foreach ($target as &$inner) {
data_forget($inner, $segments);
<?php {
$records = $this->select($query, $bindings, $useReadPdo);
return array_shift($records);
}
<?php protected function loadMissingRelation(self $models, array $path)
{
$relation = array_shift($path);
$name = explode(':', key($relation))[0];
<?php return $cast[0];
}
[$cast, $arguments] = [array_shift($cast), $cast];
return $cast.':'.implode(',', $arguments);
}),