PHP abs() Function
Example
Return the absolute value of different numbers:
"); echo(abs(-6.7) . ""); echo(abs(-3) . "
"); echo(abs(3)); ?>
Run Example »
Definition and Usage
The abs() function returns the absolute value of a number.
Syntax
abs(
number
);
| Parameters | Description |
|---|---|
| number | Required. Specifies a number. If the number is a float, the returned type is also a float, otherwise it is returned as an integer. |
Technical Details
| Return Value: | number the absolute value of |
|---|---|
| Return Type: | Float / Integer |
| PHP Version: | 4+ |
PHP Math Reference Manual