PHP tanh

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

PHP : tanh() function

Description

The tanh() function returns the hyperbolic tangent of a number.

Version

(PHP 4 and above)

Syntax

tanh(num)

Parameter

Name

Description

Required /
Optional

Type

num

A number.

Required

Float

 

Return value

The hyperbolic tangent of num.

Value Type : Float.

Example :

  1. $val1= 0;  

  2. $val2=5;  

  3. $val3=-10;  

  4. $val4= M_PI_4;  

  5. $ztanh1=tanh($val1);  

  6. $ztanh2=tanh($val2);  

  7. $ztanh3=tanh($val3);  

  8. $ztanh4=tanh($val4);  

  9. echo "Hyperbolic tangent of $ztanh1 is $ztanh1
    ";  

  10. echo "Hyperbolic tangent of $ztanh2 is $ztanh2
    ";  

  11. echo "Hyperbolic tangent of $ztanh3 is $ztanh3
    ";  

  12. echo "Hyperbolic tangent of $ztanh4 is $ztanh4
    ";  

  13. ?>   

Output :

Hyperbolic tangent of 0 is 0
Hyperbolic tangent of 0.9999092042626 is 0.9999092042626
Hyperbolic tangent of -0.99999999587769 is -0.99999999587769
Hyperbolic tangent of is