Table of Contents

Syntax

number abs(mixed $value)

(PHP 4, PHP 5)

$value A numeric value (either a float or an integer).
RETURNS The absolute value of the numeric argument ($value).

What it Does

Calculates the absolute value of the numeric argument and returns it. So if you pass it a value of -5, the result would be 5.

Example

// demonstrate the abs function
echo 'Abs(-123) = ' . abs(-123);
 
abs.txt · Last modified: Apr 18, 2008 - 2:00pm (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki