PHP tan() Function

Definition and Usage

The tan() function returns the tangent.

Syntax

tan(x)
Parameter Description
x Required. A number.

Description

tan() returns the parameter x tangent value. Parameter x is in radians

Example

In this example, we will return the tangent of different numbers:

<?php
echo(tan(M_PI_4));
echo(tan(0.50));
echo(tan(-0.50));
echo(tan(5));
echo(tan(10));
echo(tan(-5));
echo(tan(-10));
?>

Output:

1
0.546302489844
-0.546302489844
-3.38051500625
0.648360827459
3.38051500625
-0.648360827459