factorial.php
Table of Contents
Functions
- factorial() : int
- Computes the factorial `n!` of a non-negative integer.
Functions
factorial()
Computes the factorial `n!` of a non-negative integer.
factorial(int $n) : int
factorial(0) is 1. The argument is capped at 20 because 21! exceeds
PHP_INT_MAX and could no longer be represented exactly as an int.
Parameters
- $n : int
-
A non-negative integer in the range
[0, 20].
Tags
Return values
int —The factorial of $n.