1. Home
  2. Computing & Technology
  3. PHP / MySQL

Abs () PHP Function

By Angela Bradley, About.com

Definition: The absolute value of a number is the distance between the number and 0, and is always a positive number. In math it is usually depicted as two vertical lines like this: |X| (the absolute value of X.) In PHP we use the Abs () function to get this value.
Also Known As: Absolute Value Function
Examples:
<?php
abs (-6) ;
//returns a value of 6

abs (12.4) ;
//returns a value of 12.4

abs (-456.2) ;
// returns a value of 456.2
?>
Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. PHP Absolute Value - PHP ABS Function - Absolute Value Function

©2009 About.com, a part of The New York Times Company.

All rights reserved.