percentage.php
Table of Contents
Functions
- percentage() : float
- Computes which percentage a part represents of a total.
Functions
percentage()
Computes which percentage a part represents of a total.
percentage(int|float $part, int|float $total) : float
Returns ( $part / $total ) * 100. As a guard against division by zero, a
$total of 0 yields 0.0 rather than raising an error.
Parameters
- $part : int|float
-
The partial amount.
- $total : int|float
-
The total amount.
Tags
Return values
float —The percentage in the [0, 100] range for in-bounds inputs, 0.0 when $total is 0.