PHP abs() function returns the absolute value of number.
PHP abs() Function Example:
PHP abs() function returns the absolute value of number. The return type is depends on number, if number is float then return is also float otherwise it return integer value.
Example:
<?php $folat_type = 5.8; $integer_type = -36; echo(abs($folat_type) . "<br />"); echo(abs($integer_type) . "<br />"); echo(abs(91)); ?>
Output:
The output of this example is:
5.8 36 91
[ 0 ] Comments