Last Updated on May 21, 2021 by Roshan Parihar
PHP abs() Function returns the absolute value of the given number. The absolute value means it always be positive whether the number is integer or float.
Syntax of PHP abs() Function
abs(number)
Description of Parameters
Name | Description |
---|---|
number | Required. It is a numeric value that can be an integer or float type number to find the absolute value. |
Examples on PHP abs() Function
1 2 3 4 5 6 |
<?php echo abs(-17)."<br>"; echo abs(24)."<br>"; echo abs(-5)."<br>"; echo abs(9); ?> |
Output
24
5
9