Basic Trigonometry Functions

PHP supports the basic set of trigonometry functions and are listed in Table 2-4.

Table 2-4. Trigonometry functions supported by PHP
Function Description
float sin(float arg) Sine of arg in radians
float cos(float arg) Cosine of arg in radians
float tan(float arg) Tangent of arg in radians
float asin(float arg) Arc sine of arg in radians
float acos(float arg) Arc cosine of arg in radians
float atan(float arg) Arc tangent of arg in radians
float atan2(float y, float x) Arc tangent of x/y where the sign of both arguments determines the quadrant of the result
float pi( ) Returns the value 3.1415926535898
float deg2rad(float arg) Converts arg degrees to radians
float rad2deg(float arg) Converts arg radians to degrees

Powers and Logs

The PHP mathematical library includes the exponential and logarithmic functions listed in Table 2-5.

Table 2-5. Exponential and logarithmic functions
Function Description
float exp(float arg) e to the power of arg
float pow(float base, number exp) Exponential expression base to the power of exp
float sqrt(float arg) Square root of arg
float log(float arg) Natural logarithm of arg
float log10(float arg) Base-10 logarithm of arg

by BrainBellupdated