Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Extract a slice of the array
array_slice(    array $array,    int $offset,    ?int $length null,    bool $preserve_keys false): array
        $classDirnameSegments explode('\\'$classDirname);



        return 
Arr::wrap(Collection::times(count($classDirnameSegments), function ($index) use ($class$classDirnameSegments) {

            
$classDirname implode('\\'array_slice($classDirnameSegments0$index));



            return 
$classDirname.'\\Policies\\'.class_basename($class).'Policy';

        })->
reverse()->values()->first(function ($class) {
    protected function path($key)

    {

        
$parts array_slice(str_split($hash sha1($key), 2), 02);



        return 
$this->directory.'/'.implode('/'$parts).'/'.$hash;

    }
    public function slice($offset$length null)

    {

        return new static(
array_slice($this->items$offset$lengthtrue));

    }
            }



            if (
$size) {

                
$groups->push(new static(array_slice($this->items$start$size)));



                
$start += $size;

            }
                if (count($chunk) == $size) {

                    yield (new static(
$chunk))->tap(function () use (&$chunk$step) {

                        
$chunk array_slice($chunk$stepnulltrue);

                    });
    protected function getNamespace($name)

    {

        return 
trim(implode('\\'array_slice(explode('\\'$name), 0, -1)), '\\');

    }
    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])) {
        $query->wheres = [];



        
$this->groupWhereSliceForScope(

            
$queryarray_slice($allWheres0$originalWhereCount)

        );



        
$this->groupWhereSliceForScope(
        );



        
$this->groupWhereSliceForScope(

            
$queryarray_slice($allWheres$originalWhereCount)

        );

    }
    protected function getMigrationClass(string $migrationName): string

    
{

        return 
Str::studly(implode('_'array_slice(explode('_'$migrationName), 4)));

    }
        $this->wheres[] = compact('type''column''values''boolean''not');



        
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 02), 'where');



        return 
$this;

    }
        $this->havings[] = compact('type''column''values''boolean''not');



        
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 02), 'having');



        return 
$this;

    }
            }



            if (
str_starts_with($value'--env')) {

                return 
head(array_slice(explode('='$value), 1));

            }

        }

    }
    {

        if (
$numericKeys) {

            return 
$this->removeMissingValues(array_merge(

                
array_merge(array_slice($data0$indextrue), $merge),

                
$this->filter(array_values(array_slice($data$index 1nulltrue)))

            ));

        }
        if ($numericKeys) {

            return 
$this->removeMissingValues(array_merge(

                
array_merge(array_slice($data0$indextrue), $merge),

                
$this->filter(array_values(array_slice($data$index 1nulltrue)))

            ));

        }