← All built-ins / abs()
abs()
abs(mixed $number): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $number | int|float | input number |
Return value
The absolute value; int stays int, float stays float.
Example
echo abs(-5), " ", abs(2.5), " ", abs(-1.5);
5 2.5 1.5