public function slice(array $array, $begin, $end = null): array
    {
        if ($end === null) {
            $end = count($array);
        } elseif ($end < 0) {
            $end = count($array) + $end;
        }
        $length = $end - $begin;
        return array_slice($array, $begin, $length);
    }
public function slice(array $array, $begin, $end = null): array
    {
        if ($end === null) {
            $end = count($array);
        } elseif ($end < 0) {
            $end = count($array) + $end;
        }
        $length = $end - $begin;
        return array_slice($array, $begin, $length);
    }
public function slice ( array $ array , $ begin , $ end = null ) : array { if ( $ end === null ) { $ end = count ( $ array ) ; } elseif ( $ end < 0 ) { $ end = count ( $ array ) + $ end ; } $ length = $ end - $ begin ; return array_slice ( $ array , $ begin , $ length ) ; }
Extract a portion of an indexed array

@param array $array The array (with numeric indices)
@param int $begin
@param int $end
@return array
Extract a portion of an indexed array