public static function risingFactorial($x, int $n) { if ($n < 0) { throw new Exception\OutOfBoundsException('Cannot compute rising factorial of a negative number.'); } $fact = 1; while ($n > 0) { $fact *= $x + $n - 1; $n--; } return $fact; }