PHP tan() Function

Definition and Usage

The tan() function returns the tangent ratio of given angle in radians. In trigonometry, tangent of an angle is defined as ratio of lengths of opposite side and adjacent side.

tan(x) = opposite/adjacent

tangent of an angle is also defined as ratio of its sine and cosine

tan(x) = sin(x)/cos(x)

If x=45 degree, tan(x) = 1 as in a right angled traingle, opposite and adjacent sides are qual.

This function returns a float value.

Syntax

tan ( float $arg ) : float

Parameters

Sr.No Parameter & Description
1 arg
A floating point value that represents angle in radians

Return Values

PHP tan() function returns tangent ratio of given parameter.

PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

Example

<?php
   $arg=0;
   $val=tan($arg);
   echo "tan(" . $arg . ") = " . $val;
?>

Output

This will produce following result −

tan(0) = 0
Updated on: 2026-03-11T23:22:53+05:30

207 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements