[eodelcademy
ws =
PHP Concepts >
Docs /PHP / Math Functions
Math Functions
Pblhes Aor, 2028
Contribute to Docs -+
PHP has several bult-in functions for performing mathematical operations.
AAlist of PHP math operation functions can be found in the table below:
Math Functions
abs()
Returns the absolute value of the argument.
[2 FH custom Actin AtDetecor
&
a @
acos()
Returns the angle whose cosine velue is equel tothe specified value.
acosh()
Returns the inverse hyperbolic cosine value ofthe glven argument.
asin()
Returns the arc sine ofa given number.
asinh()
Returns the inverse hyperbolic sine of a number.
nm)
rns the angle whose tangent is equal tothe specified value.
atan2()
Returns the arc tangent of y/, in radians
atanh()
Returns the inverse hyperbolic tangent ofa given value
base.convert()
Converts a number from one number base to another,
bindec()
Returns an integer representing the decimal value of the binary string passed as input
ceil()
Returns the next highest integer value of the fractional argument.cost)
Returns the cosine of the angle passed ss the argument.
cosh()
Returns the hyperbolic cosine of a number.
decbin()
Converts @ decimal number toa string containing a binary number.
dechex(}
Returns a hexadecimal string representation ofa decimal number.
decoct(}
Roturns the corresponding octal value of the glen decimal value.
deg2rad()
Converts @ number in degrees tothe racian equivalent
&
a @
expt)
Returns raised to the power of x
floor()
Returns a rounded number down tothe nearest integer.
modi)
Returns the remainder (modulo of x/.
hexdec()
Returns the decimal equivalent ofa given hexadecimal string.
hypot ()
Returns the length ofthe hypotenuse of 8 90-degree triangle,
is_finite()
Evaluates whether a value is logalfrite number oF not
is_infinite()
Evaluates wnether a value is an infinite number or not
is_nan()
Checks whether a value is not @ number.
tog)
Returns the natural logarithm ofa value.
10910()
Returns the base-10 logarithm of @ number.
max()
Finds and returns the highest value in an array ora ist of variables.
nin)
Returns the lowest value out ofa group or array of values.octdect }
Converts octal numbers to decimal numbers.
0)
Returns the value of Pl
pow()
Returns the number raised to the power of the exponent.
rad2deq()
Converts radian
degrees.
round()
Ret
ins the nearest whole number to the passed value, oF the value rounded to the specified decimal precision.
sin()
Returns the sine ofa given angle.
sinh()
ins the hyperbolic sine of a number.
&
a @
sqrt ()
Calculates the square root of a number.
tan()
Returns the tangent ofthe angle passed as the argument.
tanh()
rns the hyperbolic tangent of a number.
All contributors
Looking to contribute?
+ Learn more about how to get involved.
+ Edit thi
122 07 GitHub tox an error or make an improvement.
+ Submit feedbaci
let us know how we can improve Does.
n PHP on Codecademy
Computer Science
Looking for an introduction to the theory behind programming Master Python while earning data structures, lgrthns, and more
Incluse 6 Courses
{FW Profesional CerticationAS Back to top
&
a @