PHP Math Functions

Funcion Descripcion Sintaxis
abs() Returns the absolute (positive) value of a number abs(number);
acos() Returns the arc cosine of a number acos(number);
acosh() Returns the inverse hyperbolic cosine of a number acosh(number);
asin() Returns the arc sine of a number asin(number);
asinh() Returns the inverse hyperbolic sine of a number asinh(number);
atan() Returns the arc tangent of a number in radians atan(number);
atan2() Returns the arc tangent of two variables x and y atan2($y,$x);
atanh() Returns the inverse hyperbolic tangent of a number atanh(number);
base_convert() Converts a number from one number base to another base_convert(number,frombase,tobase);
bindec() Converts a binary number to a decimal number bindec(binary_string);
ceil() Rounds a number up to the nearest integer ceil(number);
cos() Returns the cosine of a number cos(number);
cosh() Returns the hyperbolic cosine of a number cosh(number);
decbin() Converts a decimal number to a binary number decbin(number);
dechex() Converts a decimal number to a hexadecimal number dechex(number);
decoct() Converts a decimal number to an octal number decoct(number);
deg2rad() Converts a degree value to a radian value deg2rad(number);
exp() Calculates the exponent of e exp(x);
expm1() Returns exp(x) - 1 expm1(x);
floor() Rounds a number down to the nearest integer floor(number);
fmod() Returns the remainder of x/y fmod(x,y);
getrandmax() Returns the largest possible value returned by rand() getrandmax();
hexdec() Converts a hexadecimal number to a decimal number hexdec(hex_string);
hypot() Calculates the hypotenuse of a right-angle triangle hypot(x,y);
is_finite() Checks whether a value is finite or not is_finite(value);
is_infinite() Checks whether a value is infinite or not is_infinite(value);
is_nan() Checks whether a value is 'not-a-number' is_nan(value);
lcg_value() Returns a pseudo random number in a range between 0 and 1 lcg_value();
log() Returns the natural logarithm of a number log(number,base);
log10() Returns the base-10 logarithm of a number log10(number);
log1p() Returns log(1+number) log1p(number);
max() Returns the highest value in an array, or the highest value of several specified values max(array_values); or max(value1,value2,...);
min() Returns the lowest value in an array, or the lowest value of several specified values min(array_values); or min(value1,value2,...);
mt_getrandmax() Returns the largest possible value returned by mt_rand() mt_getrandmax();
mt_rand() Generates a random integer using Mersenne Twister algorithm mt_rand(); or mt_rand(min,max);
mt_srand() Seeds the Mersenne Twister random number generator mt_srand(seed);
octdec() Converts an octal number to a decimal number octdec(octal_string);
pi() Returns the value of PI pi();
pow() Returns x raised to the power of y pow(x,y);
rad2deg() Converts a radian value to a degree value rad2deg(number);
rand() Generates a random integer rand(); or rand(min,max);
round() Rounds a floating-point number round(number,precision,mode);
sin() Returns the sine of a number sin(number);
sinh() Returns the hyperbolic sine of a number sinh(number);
sqrt() Returns the square root of a number sqrt(number);
srand() Seeds the random number generator srand(seed);
tan() Returns the tangent of a number tan(number);
tanh() Returns the hyperbolic tangent of a number tanh(number);



۩_ Inicio
─►Siguiente Ejercicio
◄─Anterior Ejercicio