PHP Math 함수
PHP Math 소개
수학 (Math) 함수는 integer와 float 범위의 값을 처리할 수 있습니다.
설치
수학 (Math) 함수는 PHP의 핵심 구성 요소입니다. 설치하지 않고 사용할 수 있습니다.
PHP Math 함수
PHP:이 함수를 지원하는 가장 오래된 PHP 버전을 나타냅니다.
함수 | 설명 | PHP |
---|---|---|
abs() | 절대값 | 3 |
acos() | 반cosine | 3 |
acosh() | 반hyperbolic cosine | 4 |
asin() | 반sine | 3 |
asinh() | 반hyperbolic sine | 4 |
atan() | 반비례 각도 | 3 |
atan2() | 두 개의 매개변수의 반비례 각도 | 3 |
atanh() | inverse hyperbolic tangent. | 4 |
base_convert() | convert numbers between any base. | 3 |
bindec() | convert binary to decimal. | 3 |
ceil() | round up to the nearest integer. | 3 |
cos() | cosine. | 3 |
cosh() | hyperbolic cosine. | 4 |
decbin() | convert decimal to binary. | 3 |
dechex() | convert decimal to hexadecimal. | 3 |
decoct() | convert decimal to octal. | 3 |
deg2rad() | convert angle to radian. | 3 |
exp() | return Ex value. | 3 |
expm1() | return Ex the value of -1. | 4 |
floor() | round down to the nearest integer. | 3 |
fmod() | return the floating-point remainder of division. | 4 |
getrandmax() | display the maximum possible value of a random number. | 3 |
hexdec() | convert hexadecimal to decimal. | 3 |
hypot() | calculate the hypotenuse length of a right triangle. | 4 |
is_finite() | determine whether it is a finite value. | 4 |
is_infinite() | determine whether it is an infinite value. | 4 |
is_nan() | determine whether it is a valid number. | 4 |
lcg_value() | return a pseudo-random number in the range (0, 1). | 4 |
log() | natural logarithm. | 3 |
log10() | logarithm to the base 10. | 3 |
log1p() | return log(1 + number). | 4 |
max() | return the maximum value. | 3 |
min() | return the minimum value. | 3 |
mt_getrandmax() | display the maximum possible value of a random number. | 3 |
mt_rand() | return a random integer using the Mersenne Twister algorithm. | 3 |
mt_srand() | seed the Mersenne Twister random number generator. | 3 |
octdec() | convert octal to decimal. | 3 |
pi() | return the value of pi. | 3 |
pow() | return x to the power of y. | 3 |
rad2deg() | convert radian numbers to degree numbers. | 3 |
rand() | return a random integer. | 3 |
round() | rounding off floating-point numbers. | 3 |
sin() | sine. | 3 |
sinh() | hyperbolic sine. | 4 |
sqrt() | square root. | 3 |
srand() | random number generator seed to be sown. | 3 |
tan() | tangent. | 3 |
tanh() | hyperbolic tangent. | 4 |
PHP Math 상수
상수 이름 | 상수 이름 | 상수 값 | PHP |
---|---|---|---|
M_E | e | 2.7182818284590452354 | 4 |
M_EULER | Euler 상수 | 0.57721566490153286061 | 5.2.0 |
M_LNPI | log_e(pi) | 1.14472988584940017414 | 5.2.0 |
M_LN2 | log_e 2 | 0.69314718055994530942 | 4 |
M_LN10 | log_e 10 | 2.30258509299404568402 | 4 |
M_LOG2E | log_2 e | 1.4426950408889634074 | 4 |
M_LOG10E | log_10 e | 0.43429448190325182765 | 4 |
M_PI | Pi | 3.14159265358979323846 | 3 |
M_PI_2 | pi/2 | 1.57079632679489661923 | 4 |
M_PI_4 | pi/4 | 0.78539816339744830962 | 4 |
M_1_PI | 1/pi | 0.31830988618379067154 | 4 |
M_2_PI | 2/pi | 0.63661977236758134308 | 4 |
M_SQRTPI | sqrt(pi) | 1.77245385090551602729 | 5.2.0 |
M_2_SQRTPI | 2/sqrt(pi) | 1.12837916709551257390 | 4 |
M_SQRT1_2 | 1/sqrt(2) | 0.70710678118654752440 | 4 |
M_SQRT2 | sqrt(2) | 1.41421356237309504880 | 4 |
M_SQRT3 | sqrt(3) | 1.73205080756887729352 | 5.2.0 |