Jump to: navigation, search

PHP Maths Functions

From w3cyberlearnings
# Function Example Description
1 abs abs(-8.4) Absolute value
2 acos acos(-8) Arc cosine
3 acosh acosh(x) Inverse hyperbolic cosine
4 asin asin(x) Arc sine
5 asinh asinh(x) Inverse hyperbolic sine
6 atan2 atan2(y,x) Arc tangent of two variables
7 atan atan(x) Arc tangent
8 atanh atanh(x) Inverse hyperbolic tangent
9 base_convert base_convert(number,from_base,to_base) Convert a number between arbitrary bases
10 bindec bindec(binary_number) Binary to decimal
11 ceil ceil(x) Round fractions up
12 cos cos(x) Cosine
13 cosh cosh(x) Hyperbolic cosine
14 decbin decbin(dec_number) Decimal to binary
15 dechex dechex(dec_number) Decimal to hexadecimal
16 decoct decoct(dec_number) Decimal to octal
17 deg2rad deg2rad(degree_number) Converts the number in degrees to the radian equivalent
18 exp exp(x) Calculates the exponent of e
19 expm1 expm1(x) Returns exp(number) - 1, computed in a way that is accurate even when the value of number is close to zero
20 floor floor(x) Round fractions down
21 fmod fmod(x,y) Returns the floating point remainder (modulo) of the division of the arguments
22 getrandmax getrandmax() Show largest possible random value
23 hexdec hexdec(hex_number) Hexadecimal to decimal
24 hypot hypot(x,y) Calculate the length of the hypotenuse of a right-angle triangle
25 is_finite is_finite(x) Finds whether a value is a legal finite number
26 is_infinite is_infinite(x) Finds whether a value is infinite
27 is_nan is_nan(x) Finds whether a value is not a number
28 lcg_value lcg_value() Combined linear congruential generator
29 log10 log10(x) Base-10 logarithm
30 log1p log1p(x) Returns log(1 + number), computed in a way that is accurate even when the value of number is close to zero
31 log log(x,base) Natural logarithm
32 max max(x,y) Find highest value
33 min min(x,y) Find lowest value
34 mt_getrandmax mt_getrandmax() Show largest possible random value
35 mt_rand mt_rand(min,max) Generate a better random value
36 mt_srand mt_srand(seed) Seed the better random number generator
37 octdec octdec(oct_number) Octal to decimal
38 pi pi() Get value of pi
39 pow pow(x,y) Exponential expression
40 rad2deg rad2deg(radian_number) Converts the radian number to the equivalent number in degrees
41 rand rand(min,max) Generate a random integer
42 round round(x,prec) Rounds a float
43 sin sin(x) Sine
44 sinh sinh(x) Hyperbolic sine
45 sqrt sqrt(x) Square root
46 srand srand(seed) Seed the random number generator
47 tan tan(x) Tangent
48 tanh tanh(x) Hyperbolic tangent

Related Links

Navigation
Web
SQL
MISC
References