PHP tan

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : tan() function

Description

The tan() function returns the tangent of a number.

Version

(PHP 4 and above)

Syntax

tan(num)

Parameter

Name

Description

Required /
Optional

Type

num

A number.

Required

Float

Return value

The tangent of num.

Value Type : Float

Pictorial Presentation

php-math-tan()

Example :

  1. $val1= 0;  

  2. $val2=4;  

  3. $val3=-4;  

  4. $val4= M_PI_4;  

  5. $ztan1=tan($val1);  

  6. $ztan2=tan($val2);  

  7. $ztan3=tan($val3);  

  8. $ztan4=cos($val4);  

  9. echo "Tangent of $val1 is $ztan1
    ";  

  10. echo "Tangent of $val2 is $ztan2
    ";  

  11. echo "Tangent of $val3 is $ztan3
    ";  

  12. echo "Tangent of $val4 is $ztan4
    ";  

  13. ?>  

Output :

Tangent of 0 is 0
Tangent of 4 is 1.1578212823496
Tangent of -4 is -1.1578212823496
Tangent of  M_PI_4 is