X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP abs() Function

PHP Math Reference PHP Math Reference

Example

Return the absolute value of different numbers:

<?php
echo(abs(6.7) . "<br>");
echo(abs(-6.7) . "<br>");
echo(abs(-3) . "<br>");
echo(abs(3));
?>

Run example »

Definition and Usage

The abs() function returns the absolute (positive) value of a number.


Syntax

abs(number);

Parameter Description
number Required. Specifies a number. If the number is of type float, the return type is also float, otherwise it is integer

Technical Details

Return Value: The absolute value of the number
Return Type: Float / Integer
PHP Version: 4+


PHP Math Reference PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook