May 11, 2021 PHP
The Math function handles the values in PHP, which contains many mathematical functions for calculations, and this section will show you one by one!
The Math function can handle values in the integer and float ranges.
The PHP Math function is part of the PHP core. These functions can be used without installation.
function | describe |
---|---|
abs() | Returns an absolute value of a number. |
acos() | Returns a number of anti-rest. |
acosh() | Returns a number of anti-hypecosord. |
asin() | Returns a number of negative strings. |
asinh() | Returns a number of opposite sinusoids. |
atan() | Returns a number of annectaneous cut. |
atan2() | Returns an interpolation of two variables x and y. |
atanh() | Returns a number of anti-double songs. |
base_convert() | Convert numbers between arbitrary entries. |
bindec() | Convert the binary number to a decimal number. |
ceil() | Return up to the closest integer. |
cos() | Returns a number of cosine. |
cosh() | Returns a number of twins. |
decbin() | Convert the decimal number to a binary number. |
dechex() | Convert the decimal number to a hexadecimal number. |
decoct() | Convert the decimal number to an eight-input number. |
deg2rad() | Convert the angle value to an arc value. |
exp() | Returns E x Value. |
expm1() | Returns E x - 1 value. |
floor() | Follow down to the closest integer. |
fmod() | Returns the number of floating points of X / Y. |
getrandmax() | Returns the maximum possible value of the random number displayed by calling the RAND () function. |
hexdec() | Convert the hexadecimal number to a decimal number. |
hypot() | Calculate the length of the horizontal triangle. |
is_finite() | Judgment is a limited value. |
is_infinite() | The determination is an infinite value. |
is_nan() | Judging whether it is a non-value. |
lcg_value() | Return to a pseudo random number of (0, 1). |
log() | Returns a number of natural logaries (bottom at e). |
log10() | Returns a number of logged logs at 10. |
log1p() | Return log (1 + Number) |
max() | Returns the maximum value in an array, or the maximum value in several specified values. |
min() | Returns the minimum value in an array, or the minimum in several specified values. |
mt_getrandmax() | Returns the maximum possible value of the random number displayed by calling the MT_RAND () function. |
mt_rand() | Random integers using the Mersenne Twister algorithm. |
mt_srand() | Sowing Mersenne Twister Random Meter. |
octdec() | Convert the eight-input number to a decimal number. |
pi() | Returns the value of the circular rate Pi. |
pow() | Returns the Y the Y. |
rad2deg() | Convert the arc value to an angle value. |
rand() | Returns the random integer. |
round() | Since the floating point number is rounded. |
sin() | Returns a number of sinushes. |
sinh() | Returns a number of double sinusoids. |
sqrt() | Returns a square root. |
srand() | Sowing random number generator. |
tan() | Returns a number of orthosis. |
tanh() | Returns a number of hypothesis. |
constant | value | describe | PHP version |
---|---|---|---|
INF | INF | unlimited | PHP 4 |
M_E | 2.7182818284590452354 | Returns E | PHP 4 |
M_EULER | 0.57721566490153286061 | Return Euler constant | PHP 4 |
M_LNPI | 1.14472988584940017414 | Natural logarithm return of the circular rate Pi: log_e (pi) | PHP 5.2 |
M_LN2 | 0.69314718055994530942 | Return 2 Natural Logo: Log_e 2 | PHP 4 |
M_LN10 | 2.30258509299404568402 | Returns 10 natural logarithm: log_e 10 | PHP 4 |
M_LOG2E | 1.4426950408889634074 | Returns E. 2 is the right number of bottom: log_2 e | PHP 4 |
M_LOG10E | 0.43429448190325182765 | Returns E. 10 is the right number of bottom: log_10 e | PHP 4 |
M_PI | 3.14159265358979323846 | Return to Pi | PHP 4 |
M_PI_2 | 1.57079632679489661923 | Return to PI / 2 | PHP 4 |
M_PI_4 | 0.78539816339744830962 | Return to PI / 4 | PHP 4 |
M_1_PI | 0.31830988618379067154 | Return 1 / Pi | PHP 4 |
M_2_PI | 0.63661977236758134308 | Return 2 / Pi | PHP 4 |
M_SQRTPI | 1.77245385090551602729 | Return the square root of the circular rate Pi: SQRT (Pi) | PHP 5.2 |
M_2_SQRTPI | 1.12837916709551257390 | Returns 2 / square root of the circular rate Pi: 2 / SQRT (Pi) | PHP 4 |
M_SQRT1_2 | 0.70710678118654752440 | Returns 1/2 square root: 1 / SQRT (2) | PHP 4 |
M_SQRT2 | 1.41421356237309504880 | Returns 2 square roots: SQRT (2) | PHP 4 |
M_SQRT3 | 1.73205080756887729352 | Return 3 square root: SQRT (3) | PHP 5.2 |
NAN | NAN | Not a number | PHP 4 |
PHP_ROUND_HALF_UP | 1 | When you encounter .5, round it up. | PHP 5.3 |
PHP_ROUND_HALF_DOWN | 2 | Follow down when you encounter .5 | PHP 5.3 |
PHP_ROUND_HALF_EVEN | 3 | When you encounter .5, the clique is rounded. | PHP 5.3 |
PHP_ROUND_HALF_ODD | 4 | When you encounter .5, you're gratifying | PHP 5.3 |
This section mentions a relatively large number of mathematical functions, read them carefully and learn how to use them!