Search w3schools.com:

SHARE THIS PAGE

PHP tan() Function


PHP Math Reference Complete PHP Math Reference

Definition and Usage

The tan() function returns a number that represents the tangent of an angle.

Syntax

tan(x)

Parameter Description
x Required. A number


Example

In this example we will get the tangent of different numbers:

<?php
echo(tan(M_PI_4) . "<br />");
echo(tan(0.50) . "<br />");
echo(tan(-0.50) . "<br />");
echo(tan(5) . "<br />");
echo(tan(10) . "<br />");
echo(tan(-5) . "<br />");
echo(tan(-10))
?>

The output of the code above will be:

1
0.546302489844
-0.546302489844
-3.38051500625
0.648360827459
3.38051500625
-0.648360827459


PHP Math Reference Complete PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]