Return the absolute values of distinct numbers:
<?phpecho(abs(6.7) . "<br>");echo(abs(-6.7) . "<br>");echo(abs(-3) . "<br>");echo(abs( 3));?>The abs() function returns the absolute value of a number.
abs( number );
| parameter | describe |
|---|---|
| number | Required. Specify a number. If the type of the number is floating point, the returned type is also floating point, otherwise it is returned as an integer. |
| Return value: | The absolute value of number . |
|---|---|
| Return type: | Float/Integer |
| PHP version: | 4+ |