php abs() function
Translation results:
英 [æbz]
abbr.acrylonitrile-butadiene-styrene acrylonitrile-butadiene-styrene;absence absence;absorption absorption;absorb (ent) absorption
php abs() functionsyntax
How to use the abs() function?
The function of abs() function is to return the absolute value of a number. The syntax is abs(number). If the parameter number is float, the return type is also float, otherwise it returns integer (because float usually has a larger value range than integer).
Function: The function of abs() function is to return the absolute value of a number
Syntax: abs(number)
Parameters:
Parameters | Description |
number | Must be a number |
Description: Returns the absolute value of the parameter. If the parameter is float, the returned type is also float. If the parameter is int, the return type is int, if the parameter is a string string, 0 is returned;
php abs() functionexample
<?php $i = -100; $j = abs($i); $a = 6.7; $b = abs($a); $k = "hello world"; $c = abs($k); echo $j."*****".$b."*****".$c; ?>
Run instance»
Click the "Run instance" button to view the online instance
Output:
100*****6.7******0