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: 2008/04/18 14:00 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki