MathPHP\Functions\Arithmetic::multiply PHP Méthode

multiply() public static méthode

Returns the product as a callback function.
public static multiply ( variadic $args ) : callable
$args variadic
Résultat callable Product of the input functions
    public static function multiply(callable ...$args)
    {
        $product = function ($x, ...$args) {
            $function = 1;
            foreach ($args as $arg) {
                $function *= $arg($x);
            }
            return $function;
        };
        return function ($x) use($args, $product) {
            return call_user_func_array($product, array_merge([$x], $args));
        };
    }
Arithmetic