abs() function in PHP

abs() is an PHP’s inbuilt function. It returns a positive number. Its parameter accepts a numeric value that may be positive or negative but will return only a positive value.

See example below:-

<?php


echo abs(-33); // Output will be 33
echo "<br>";
echo abs(-19.33); // Output will be 19.33
echo "<br>";
echo abs(78); //Output will be 78


?>

Leave a Comment