← All built-ins / abs()

abs()

abs(mixed $number): mixed

Parameters

NameTypeDescription
$numberint|floatinput 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

See also

round()floor()ceil()