Definition and usage: The abs() function returns the absolute value of a number.
Syntax: abs(x), the code is as follows:
$abs=abs(-3.2); //$abs=3.2
$abs2= abs(5); //$abs2=5
$abs3=abs(-5); ceil(x)
Parameter description
x is required, a number.
Instructions: Return the next integer that is not less than x. If x has a decimal part, it will be rounded up. The type returned by ceil() is still float, because The range of float values is usually larger than that of integer. The example code is as follows:
echo ceil(5);
";
echo ceil(6.999); The floor() function rounds down to the nearest integer.
Syntax: floor(x)
Parameter description
x required, A number.
Explanation: Return the next integer not greater than x, round off the decimal part of x, the type returned by floor() is still float, because the range of float values is usually larger than integer.
echo floor(4); //4
echo "
";
echo floor(3.3);
Definition and usage
fmod() function returns the floating point remainder of division.
Syntax: fmod(x,y)
Parameter description
x required, a number.
y required, a number.
Description: Returns the floating-point remainder obtained by dividing the dividend (x) by the divisor (y). The definition of the remainder (r) is: x = i * y + r, where i is an integer. If y is a non-zero value, then r and x have the same sign and their quantitative value is less than y, the code is as follows:
$x=4.7; using using with use with using to having ’s ’ using ’s having the same sign ’s to ‐ ‐ ‐ ‐ //Define value 2
$r=fmod($x,$y) ;
Syntax: log10(x)
Parameter description
x is required, a number.
Description: Returns the base 10 logarithm of parameter x, the code is as follows:
$num1=100;
$num2= 1000;
$num3=3;
$result1=log10($num1);
$result2=log10($num2);
$result3=log10($num3);
echo "$num1 to 10 The base 10 logarithm of $num2 is $result2";
echo "
";
echo "$num2 The base 10 logarithm of $num2 is $result2"; echo "The base 10 logarithm of $num3 is $result3";
echo "
";
log() returns the natural logarithm.
Syntax: log(x,base)
Parameter description
x required, a number.
base optional, if this parameter is specified, logbasex is returned.
Note: If the optional parameter base is specified, log() returns logbasex, otherwise log() returns parameter x The natural logarithm of The natural logarithm of the value
echo "
";
echo log(1); //Returns the natural logarithm of the specified value
echo "
"; (0); //Returns the natural logarithm of the specified value
echo "
";
echo log(-1); sqrt (9);
var_dump( pow(2, 8)); //Output 256 echo "echo pow(0,0); //Output 1
echo "
";
echo pow(-1, 4.5); //Return error