PHP abs() Function Example

PHP abs() Function Example


Posted in : PHP Posted on : January 28, 2011 at 4:48 PM Comments : [ 0 ]

PHP abs() function returns the absolute value of number.

PHP abs() Function Example:

PHP abs() function returns the absolute value of number. The return type is depends on number, if number is float then return is also float otherwise it return integer value.

Example:

<?php
$folat_type = 5.8;
$integer_type = -36;
echo(abs($folat_type) . "<br />");
echo(abs($integer_type) . "<br />");
echo(abs(91));
?>

Output:

The output of this example is:

5.8
36
91

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics