int/float abs ( int/float $number )
abs() returns the absolute value of a given number
※ available F/W version : all
Returns the absolute value of the number. If the argument is float, it returns float, and if the argument is integer, it returns integer
<?php
$ret1 = abs(-10.11);
$ret2 = abs(10.11);
$ret3 = abs(-10);
$ret4 = abs(10);
echo "ret = $ret1\r\n"; // OUTPUT: ret = 10.11
echo "ret = $ret2\r\n"; // OUTPUT: ret = 10.11
echo "ret = $ret3\r\n"; // OUTPUT: ret = 10
echo "ret = $ret4\r\n"; // OUTPUT: ret = 10
?>
None
This function is identical to the PHP group’s abs() function.