abs() function in PHP

Date Published: 02/04/2021 Published By: JaiSchool

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


?>

Publish A Comment

Leave a Reply

Your email address will not be published. Required fields are marked *