PHP/Math/abs
abs( ) function returns the absolute value of the parameter
<?
abs(50); // 50
abs(-12); // 12
?>
Calling the Built-in abs() Function
<html>
<head><title>Calling the Built-in abs() function</title></head>
<body>
<div>
<?php
$num = -321;
$newnum = abs( $num );
print $newnum;
?>
</div>
</body>
</html>
You can either send a floating-point number or an integer to abs( )
<?
abs(50.1); // 50.1
abs(-12.5); // 12.5
?>