Jump to: navigation, search

Php abs

From w3cyberlearnings

Contents

PHP function abs

This function is returns the absolute value of a given number.

Syntax abs

  • x: is a number.

abs(x)

Example 1

<?php
$price1 = -2.5;
$price2 = 8.8;

echo abs($price1);
echo "<br/>";
echo abs($price2);
?>

Output

2.5
8.8

Related Links


Navigation
Web
SQL
MISC
References