public static function times($n, callable $iterator, $context = null)
    {
        static::associate($iterator, $context);

        $n = max(0, $n);
        $accum = [];
        for ($i=0; $i<$n; $i++)
            $accum[] = $iterator($i);

        return $accum;
    }
public static function times($n, callable $iterator, $context = null)
    {
        static::associate($iterator, $context);

        $n = max(0, $n);
        $accum = [];
        for ($i=0; $i<$n; $i++)
            $accum[] = $iterator($i);

        return $accum;
    }
public static function times ( $ n , callable $ iterator , $ context = null ) { static :: associate ( $ iterator , $ context ) ; $ n = max ( 0 , $ n ) ; $ accum = [ ] ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ accum [ ] = $ iterator ( $ i ) ; return $ accum ; }
Invokes the given iterator function n times. Each invocation of iterator is called with an index argument.
Produces an array of the returned values.

@category Utility Functions

@param int $n the number of time $iterator will be run
@param callable $iterator the iterator function
@param object $context optional, if provided will become the context for $iterator

@return array
Invokes the given iterator function n times . Each invocation of iterator is called with an index argument . Produces an array of the returned values .