tanh() function in PHP

PHPProgrammingServer Side Programming

The tanh() function returns the hyperbolic tangent of the specified value.

Syntax

tanh(val)

Parameters

  • val − A value in radians

Return

The tanh() function returns the hyperbolic tangent of the specified value val.

Example

The following is an example to get the hyperbolic tangent of 0 and 1:

 Live Demo

<?php
   echo(tanh(0) . "<br>");
   echo(tanh(1) . "<br>");
?>

Output

0<br>0.76159415595576<br>

Example

Let us see an example to get the hyperbolic tangent of constant M_PI_4 −

 Live Demo

<?php
   echo(tanh(M_PI_4));
?>

Output

0.65579420263267

Example

Let us see an example to get the hyperbolic tangent of values 0.50 and -0.50 −

 Live Demo

<?php
   echo(tanh(0.50) . "<br>");
   echo(tanh(-0.50));
?>

Output

0.46211715726001<br>-0.46211715726001

Example

Let us see another example to get the hyperbolic tangent of negative values −

 Live Demo

<?php
   echo(tanh(-5) . "<br>");
   echo(tanh(-10));
?>

Output

-0.9999092042626<br>-0.99999999587769
raja
Published on 09-Nov-2018 13:10:48

Advertisements