protected static function __zipWith(callable $f, array $a, array $b) : array
    {
        $result = [];

        while (($ai = array_shift($a)) !== null && ($bi = array_shift($b)) !== null) {
            $result[] = $f($ai, $bi);
        }

        return $result;
    }
protected static function __zipWith(callable $f, array $a, array $b) : array
    {
        $result = [];

        while (($ai = array_shift($a)) !== null && ($bi = array_shift($b)) !== null) {
            $result[] = $f($ai, $bi);
        }

        return $result;
    }
protected static function __zipWith ( callable $ f , array $ a , array $ b ) : array { $ result = [ ] ; while ( ( $ ai = array_shift ( $ a ) ) !== null && ( $ bi = array_shift ( $ b ) ) !== null ) { $ result [ ] = $ f ( $ ai , $ bi ) ; } return $ result ; }
Custom Array Zip

Given two arrays a and b, and some combinator f, combine the arrays using the combinator
f(ai, bi) into a new array c. If a and b are not the same length, the resultant array will
always be the same length as the shorter array, i.e. the zip stops when it runs out of pairs.

@example
$combinator = function($a, $b) { return $a + $b; };
Arrays::zipWith($combinator, [1, 2, 3], [0, 8, -1]); // [1, 10, 2]

@example
$combinator = function($a, $b) { return $a - $b; };
Arrays::zipWith($combinator, [0], [1, 2, 3]); // [-1]

@type (a -> b -> c) -> [a] -> [b] -> [c]

@param  Callable $f The function used to combine $a and $b
@param  array    $a The first array to use in the combinator
@param  array    $b The second array to use in the combinator
@return array       The result of calling f with each element of a and b in series
Custom Array Zip