In php, we can easily do trigonometry with the many trig functions from the php math functions. In this article, you will learn about all the trigonometric functions that you can use in php to perform trigonometry easily.

In php, we can easily use trigonometric functions with the help of the php math functions. The php math functions allow us to perform trigonometry easily.

In this article, we are going to go over all of the trig functions you can use in php and give examples of how to use each one.

Below is a list of each of the trigonometric functions you can use in php. If you want, you can keep scrolling or click on one of the links below to go to a section directly.

- pi in php
- php deg2rad() Function
- php rad2deg() Function
- php sin() Function
- php cos() Function
- php tan() Function
- php asin() Function
- php acos() Function
- php atan() Function
- php atan2() Function
- php sinh() Function
- php cosh() Function
- php tanh() Function
- php asinh() Function
- php acosh() Function
- php atanh() Function

## How We Can Use Pi in php

When doing trigonometry, the most fundamental number is pi.

To get the value of pi in php, the easiest way is use the php math constant pi. pi returns the value 3.1415926535898.

`echo pi(); // 3.1415926535898`

## How to Convert Degrees to Radians with deg2rad() Function in php

When working with angles, it’s important to be able to convert between radians and degrees easily. We can convert degrees to radians using the php deg2rad() function.

The **deg2rad()** function multiplies the degrees by pi divides by 180.

Below are some examples of how we can use the **deg2rad()** function to convert degrees to radians in php.

```
echo deg2rad(0);
echo deg2rad(30);
echo deg2rad(60);
echo deg2rad(90);
// Output:
0.0
0.5235987755982988
1.0471975511965976
1.5707963267948966
```

## How to Convert Radians to Degrees with rad2deg() Function in php

When working with angles, it’s important to be able to convert between radians and degrees easily. We can convert radians to degrees using the php rad2deg() function.

The **rad2deg()** function multiplies the radians by 180 and divides by pi.

Below are some examples of how we can use the **rad2deg()** function to convert radians to degrees in php.

```
echo rad2deg(0);
echo rad2deg(pi()/6);
echo rad2deg(pi()/3);
echo rad2deg(pi()/2);
// Output:
0
30
60
90
```

## How to Find Sine of Number with sin() Function in php

To find the sine of a number, in radians, we use the php sin() function.

The input to the **sin()** function must be a float. The return value will be a float between -1 and 1.

Below are a few examples of how to use the php **sin()** function to find the sine of a number.

```
echo sin(pi()/3);
echo sin(0);
echo sin(pi()/2);
// Output:
0.8660254037844386
0.0
1.0
```

## How to Find Cosine of Number with cos() Function in php

To find the cosine of a number, in radians, we use the php cos() function.

The input to the **cos()** function must be a float. The return value will be a float between -1 and 1.

Below are a few examples of how to use the php **cos()** function to find the cosine of a number.

```
echo cos(pi()/3);
echo cos(0);
echo cos(pi()/2);
// Output:
0.5000000000000001
1.0
6.123233995736766e-17
```

## How to Find Tangent of Number with tan() Function in php

To find the tangent of a number, or the sine divided by the cosine of an angle, in radians, we use the php tan() function.

The input to the **tan()** function must be a float. The return value will be a float between negative infinity and infinity.

Below are a few examples of how to use the php **tan()** function to find the tangent of a number.

```
echo tan(pi()/3);
echo tan(0);
echo tan(pi()/2);
// Output:
1.7320508075688767
0.0
1.633123935319537e+16
```

## How to Find Arcsine of Number with asin() Function in php

To find the arcsine of a number, we use the php asin() function.

The input to the **asin()** function must be a float between -1 and 1. The return value will be a float between -pi/2 and pi/2 radians.

Below are a few examples of how to use the php **asin()** function to find the arcsine of a number.

```
echo asin(0.5);
echo asin(0);
echo asin(-0.75);
// Output:
0.5235987755982989
0.0
-0.848062078981481
```

## How to Find Arccosine of Number with acos() Function in php

To find the arccosine of a number, we use the php acos() function.

The input to the **acos()** function must be a float between -1 and 1. The return value will be a float between 0 and pi radians.

Below are a few examples of how to use the php **acos()** function to find the arccosine of a number.

```
echo acos(0.5);
echo acos(0);
echo acos(-0.75);
// Output:
1.0471975511965979
1.5707963267948966
2.4188584057763776
```

## How to Find Arctangent of Number with atan() Function in php

To find the arctangent of a number, we use the php atan() function.

The input to the **atan()** function must be a float. The return value will be a float between -pi/2 and pi/2 radians.

Below are a few examples of how to use the php **atan()** function to find the arctangent of a number.

```
echo atan(5);
echo atan(0);
echo atan(-3);
// Output:
1.373400766945016
0.0
-1.2490457723982544
```

## How to Find Arctangent of the Quotient of Two Numbers with atan2() Function in php

php gives us the ability to find the arctangent of the quotient of two numbers, where the two numbers represents the coordinates of a point (x,y). To find the arctangent of a the quotient of two numbers, we use the php atan2() function.

The inputs to the **atan2()** function must be a floats. The return value will be a float between -pi and pi radians.

Below are a few examples of how to use the php **atan2()** function to find the arctangent of the quotient of two numbers.

```
echo atan2(5,1);
echo atan2(0,0);
echo atan2(-3,7);
// Output:
1.373400766945016
0.0
-0.40489178628508343
```

## How to Find Hyperbolic Sine of Number with sinh() Function in php

To find the hyperbolic sine of a number, we can use the php sinh() function.

The input to the **sinh()** function must be a float. The return value will be a float.

Below are a few examples of how to use the php **sinh()** function to find the hyperbolic sine of a number.

```
echo sinh(100);
echo sinh(0);
echo sinh(-50);
// Output:
1.3440585709080678e+43
0.0
-2.592352764293536e+21
```

## How to Find Hyperbolic Cosine of Number with cosh() Function in php

To find the hyperbolic cosine of a number, we can use the php cosh() function.

The input to the **cosh()** function must be a float. The return value will be a float greater than or equal to 1.

Below are a few examples of how to use the php **cosh()** function to find the hyperbolic cosine of a number.

```
echo cosh(100);
echo cosh(0);
echo cosh(-50);
// Output:
1.3440585709080678e+43
1.0
2.592352764293536e+21
```

## How to Find Hyperbolic Tangent of Number with tanh() Function in php

To find the hyperbolic tangent of a number, we can use the php tanh() function.

The input to the **tanh()** function must be a float. The return value will be a float between -1 and 1.

Below are a few examples of how to use the php **tanh()** function to find the hyperbolic tangent of a number.

```
echo tanh(20);
echo tanh(0);
echo tanh(-10);
// Output:
1.0
0.0
-0.9999999958776927
```

## How to Find Hyperbolic Arcsine of Number with asinh() Function in php

To find the hyperbolic arcsine of a number, we can use the php asinh() function.

The input to the **asinh()** function must be a float. The return value will be a float.

Below are a few examples of how to use the php **asinh()** function to find the hyperbolic arcsine of a number.

```
echo asinh(10);
echo asinh(0);
echo asinh(-5.32);
// Output:
2.99822295029797
0.0
-2.3733388650599814
```

## How to Find Hyperbolic Arccosine of Number with acosh() Function in php

To find the hyperbolic arccosine of a number, we can use the php acosh() function.

The input to the **acosh()** function must be a float greater than or equal to 1. The return value will be a float.

Below are a few examples of how to use the php **acosh()** function to find the hyperbolic arccosine of a number.

```
echo acosh(5.23);
echo acosh(1.2);
echo acosh(100);
// Output:
2.3382907483329896
0.6223625037147786
5.298292365610484
```

## How to Find Hyperbolic Arctangent of Number with atanh() Function in php

To find the hyperbolic arctangent of a number, we can use the php atanh() function.

The input to the **atanh()** function must be a float between -1 and 1. The return value will be a float.

Below are a few examples of how to use the php **atanh()** function to find the hyperbolic arctangent of a number.

```
echo atanh(0.5);
echo atanh(0);
echo atanh(-0.75);
// Output:
0.5493061443340549
0.0
-0.9729550745276566
```

Hopefully this article has been useful for you to learn how to use trig functions in php for trigonometry.

## Leave a Reply