PHP Math abs


abs() function: get the absolute value of the parameter, if the parameter is a string then return 0.

grammar:

Number abs(mixed number)

example:

echo abs(-4.2); // Output: 4.2
echo abs(-5); // Output: 5
echo abs('hello'); // Output: 0

Tip

If the argument number is a float, the returned type is also a floating-point type, otherwise an integer is returned, since a float usually has a larger range of values than integer.




Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook