Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Set the internal pointer of an array to its last element
<?php end(array|object &$array): mixed
<?php public static function last($array, ?callable $callback = null, $default = null)
{
if (is_null($callback)) {
return empty($array) ? value($default) : end($array);
}
return static::first(array_reverse($array, true), $callback, $default);
<?php }
if (count($array) === 1) {
return end($array);
}
$finalItem = array_pop($array);
<?php function last($array)
{
return end($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 protected function findInContextualBindings($abstract)
{
return $this->contextual[end($this->buildStack)][$abstract] ?? null;
}
<?php protected function getLastParameterOverride()
{
return count($this->with) ? end($this->with) : [];
}
<?php $segments = preg_split('/\s+as\s+/i', $this->query->from);
$qualifiedColumn = end($segments).'.'.$column;
$values[$qualifiedColumn] = Arr::get($values, $qualifiedColumn, $values[$column]);
<?php }
if (is_callable($value)) {
$path[count($segments) - 1][end($segments)] = $value;
}
$this->loadMissingRelation($this, $path);
<?php {
$segments = explode('.', $this->getQualifiedForeignKeyName());
return end($segments);
}
<?php $min = $this->parameter(is_array($where['values']) ? reset($where['values']) : $where['values'][0]);
$max = $this->parameter(is_array($where['values']) ? end($where['values']) : $where['values'][1]);
return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max;
}
<?php $min = $this->wrap(is_array($where['values']) ? reset($where['values']) : $where['values'][0]);
$max = $this->wrap(is_array($where['values']) ? end($where['values']) : $where['values'][1]);
return $this->wrap($where['column']).' '.$between.' '.$min.' and '.$max;
}
<?php public function zadd($key, ...$dictionary)
{
if (is_array(end($dictionary))) {
foreach (array_pop($dictionary) as $member => $score) {
$dictionary[] = $score;
$dictionary[] = $member;
<?php $prefix = implode('/', array_slice($segments, 0, -1));
return [end($segments), $prefix];
}
<?php $uri = $this->getNestedResourceUri($segments);
return str_replace('/{'.$this->getResourceWildcard(end($segments)).'}', '', $uri);
}