Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Extract a slice of the array
<?php array_slice( array $array, int $offset, ?int $length = null, bool $preserve_keys = false): array
<?php $property = $segments[$index];
$path = implode('.', array_slice($segments, 0, $index + 1));
$synth = $this->propertySynth($target, $context, $path);
<?php $classDirnameSegments = explode('\\', $classDirname);
return Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class, $classDirnameSegments) {
$classDirname = implode('\\', array_slice($classDirnameSegments, 0, $index));
return $classDirname.'\\Policies\\'.class_basename($class).'Policy';
})->reverse()->values()->first(function ($class) {
<?php public function path($key)
{
$parts = array_slice(str_split($hash = sha1($key), 2), 0, 2);
return $this->directory.'/'.implode('/', $parts).'/'.$hash;
}
<?php public static function take($array, $limit)
{
if ($limit < 0) {
return array_slice($array, $limit, abs($limit));
}
return array_slice($array, 0, $limit);
<?php return array_slice($array, $limit, abs($limit));
}
return array_slice($array, 0, $limit);
}
<?php public function slice($offset, $length = null)
{
return new static(array_slice($this->items, $offset, $length, true));
}
<?php }
if ($size) {
$groups->push(new static(array_slice($this->items, $start, $size)));
$start += $size;
}
<?php if (count($chunk) == $size) {
yield (new static($chunk))->tap(function () use (&$chunk, $step) {
$chunk = array_slice($chunk, $step, null, true);
});
<?php protected function getNamespace($name)
{
return trim(implode('\\', array_slice(explode('\\', $name), 0, -1)), '\\');
}
<?php public function tag($abstracts, $tags)
{
$tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1);
foreach ($tags as $tag) {
if (! isset($this->tags[$tag])) {
<?php $query->wheres = [];
$this->groupWhereSliceForScope(
$query, array_slice($allWheres, 0, $originalWhereCount)
);
$this->groupWhereSliceForScope(
<?php );
$this->groupWhereSliceForScope(
$query, array_slice($allWheres, $originalWhereCount)
);
}
<?php protected function getMigrationClass(string $migrationName): string
{
return Str::studly(implode('_', array_slice(explode('_', $migrationName), 4)));
}
<?php $this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');
return $this;
}
<?php $this->havings[] = compact('type', 'column', 'values', 'boolean', 'not');
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having');
return $this;
}