public static function every(array $array, int $step, int $offset = 0): array
    {
        $new = [];

        $position = 0;

        foreach ($array as $key => $item) {
            if ($position % $step === $offset) {
                $new[] = $item;
            }

            ++$position;
        }

        return $new;
    }
public static function every(array $array, int $step, int $offset = 0): array
    {
        $new = [];

        $position = 0;

        foreach ($array as $key => $item) {
            if ($position % $step === $offset) {
                $new[] = $item;
            }

            ++$position;
        }

        return $new;
    }
public static function every ( array $ array , int $ step , int $ offset = 0 ) : array { $ new = [ ] ; $ position = 0 ; foreach ( $ array as $ key => $ item ) { if ( $ position % $ step === $ offset ) { $ new [ ] = $ item ; } ++ $ position ; } return $ new ; }
Create a new array consisting of every n-th element.

@param array $array
@param int   $step
@param int   $offset

@return array
Create a new array consisting of every n - th element .