PHP Math Functions PHP数学函数
The math functions can handle values within the range of integer and float types. 这些数学函数仅能处理在你计算机上 integer 和 float 范围内的值
PHP: indicates the earliest version of PHP that supports the function. PHP:最早支持这些函数的PHP版本
| Function 函数 | Description 说明 | PHP |
|---|---|---|
| abs() | Returns the absolute value of a number 绝对值 | 3 |
| acos() | Returns the arccosine of a number 反余弦 | 3 |
| acosh() | Returns the inverse hyperbolic cosine of a number 反双曲余弦 | 4 |
| asin() | Returns the arcsine of a number 反正弦 | 3 |
| asinh() | Returns the inverse hyperbolic sine of a number 反双曲正弦 | 4 |
| atan() | Returns the arctangent of a number as a numeric value between -PI/2 and PI/2 radians 两个参数的反正切 | 3 |
| atan2() | Returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians 反正切 | 3 |
| atanh() | Returns the inverse hyperbolic tangent of a number 反双曲正切 | 4 |
| base_convert() | Converts a number from one base to another 在任意进制之间转换数字 | 3 |
| bindec() | Converts a binary number to a decimal number 二进制转换为十进制 | 3 |
| ceil() | Returns the value of a number rounded upwards to the nearest integer 进一法取整 | 3 |
| cos() | Returns the cosine of a number 余弦 | 3 |
| cosh() | Returns the hyperbolic cosine of a number 双曲余弦 | 4 |
| decbin() | Converts a decimal number to a binary number 十进制转换为二进制 | 3 |
| dechex() | Converts a decimal number to a hexadecimal number 十进制转换为十六进制 | 3 |
| decoct() | Converts a decimal number to an octal number 十进制转换为八进制 | 3 |
| deg2rad() | Converts a degree to a radian number 将角度转换为弧度 | 3 |
| exp() | Returns the value of Ex 计算 e(自然对数的底)的指数 | 3 |
| expm1() | Returns the value of Ex - 1 返回 exp(number) - 1,甚至当 number 的值接近零也能计算出准确结果 | 4 |
| floor() | Returns the value of a number rounded downwards to the nearest integer 舍去法取整 | 3 |
| fmod() | Returns the remainder (modulo) of the division of the arguments 返回除法的浮点数余数 | 4 |
|
getrandmax() |
Returns the maximum random number that can be returned by a call to the rand() function 显示随机数最大的可能值 | 3 |
| hexdec() | Converts a hexadecimal number to a decimal number 十六进制转换为十进制 | 3 |
| hypot() | Returns the length of the hypotenuse of a right-angle triangle 计算一直角三角形的斜边长度 | 4 |
| is_finite() | Returns true if a value is a finite number 判断是否为有限值 | 4 |
| is_infinite() | Returns true if a value is an infinite number 判断是否为无限值 | 4 |
| is_nan() | Returns true if a value is not a number 判断是否为合法数值 | 4 |
| lcg_value() | Returns a pseudo random number in the range of (0,1) 组合线性同余发生器 | 4 |
| log() | Returns the natural logarithm (base E) of a number 自然对数 | 3 |
| log10() | Returns the base-10 logarithm of a number 以 10 为底的对数 | 3 |
| log1p() | Returns log(1+number) 返回 log(1 + number),甚至当 number 的值接近零也能计算出准确结果 | 4 |
| max() | Returns the number with the highest value of two specified numbers 找出最大值 | 3 |
| min() | Returns the number with the lowest value of two specified numbers 找出最小值 | 3 |
| mt_getrandmax() | Returns the largest possible value that can be returned by mt_rand() 显示随机数的最大可能值 | 3 |
| mt_rand() | Returns a random integer 产生一个随机整数 using Mersenne Twister algorithm 生成更好的随机数 | 3 |
| mt_srand() | Seeds the Mersenne Twister random number generator 播下一个更好的随机数发生器种子 | 3 |
| octdec() | Converts an octal number to a decimal number 八进制转换为十进制 | 3 |
| pi() | Returns the value of PI 得到圆周率值 | 3 |
| pow() | Returns the value of x to the power of y 指数表达式 | 3 |
| rad2deg() | Converts a radian number to a degree 将弧度数转换为相应的角度数 | 3 |
| rand() | Returns a random integer 产生一个随机整数 | 3 |
| round() | Rounds a number to the nearest integer 对浮点数进行四舍五入 | 3 |
| sin() | Returns the sine of a number 正弦 | 3 |
| sinh() | Returns the hyperbolic sine of a number 双曲正弦 | 4 |
| sqrt() | Returns the square root of a number 平方根 | 3 |
| srand() | Seeds the random number generator 播下随机数发生器种子 | 3 |
| tan() | Returns the tangent of an angle 正切 | 3 |
| tanh() | Returns the hyperbolic tangent of an angle 双曲正切 | 4 |
PHP Math Constants PHP数学常量
PHP: indicates the earliest version of PHP that supports the constant. PHP:最早支持这些常量的PHP版本
| Constant 常量 | Description 说明 | PHP |
|---|---|---|
| M_E | Returns e (approx. 2.718) e(2.7182818284590452354) | 4 |
| M_EULER | Returns Euler’s constant (approx. 0.577) 欧拉常数(0.57721566490153286061) | 4 |
| M_LNPI | Returns the natural logarithm of PI (approx. 1.144) log_e(pi)(1.14472988584940017414) | 4 |
| M_LN2 | Returns the natural logarithm of 2 (approx. 0.693) log_e 2(0.69314718055994530942) | 4 |
| M_LN10 | Returns the natural logarithm of 10 (approx. 2.302) log_e 10(2.30258509299404568402) | 4 |
| M_LOG2E | Returns the base-2 logarithm of E (approx. 1.442) log_2 e(1.4426950408889634074) | 4 |
| M_LOG10E | Returns the base-10 logarithm of E (approx. 0.434) log_10 e(0.43429448190325182765) | 4 |
| M_PI | Returns PI (approx. 3.14159) Pi(3.14159265358979323846) | 3 |
| M_PI_2 | Returns PI/2 (approx. 1.570) pi/2(1.57079632679489661923) | 4 |
| M_PI_4 | Returns PI/4 (approx. 0.785) pi/4(0.78539816339744830962) | 4 |
| M_1_PI | Returns 1/PI (approx. 0.318) 1/pi(0.31830988618379067154) | 4 |
| M_2_PI | Returns 2/PI (approx. 0.636) 2/pi(0.63661977236758134308) | 4 |
| M_SQRTPI | Returns the square root of PI (approx. 1.772) sqrt(pi)(1.77245385090551602729) | 4 |
| M_2_SQRTPI | Returns 2/square root of PI (approx. 1.128) (2/sqrt(pi)) | 4 |
| M_SQRT1_2 | Returns the square root of 1/2 (approx. 0.707) 1/sqrt(2)(0.70710678118654752440) | 4 |
| M_SQRT2 | Returns the square root of 2 (approx. 1.414) sqrt(2)(1.41421356237309504880) | 4 |
| M_SQRT3 | Returns the square root of 3 (approx. 1.732) sqrt(3)(1.73205080756887729352) | 4 |
热点搜索: No Tags

