W3Schools.com

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
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE