Home >>PHP Math Functions >PHP tanh() Function

PHP tanh() Function

PHP tanh() Function

PHP tanh() function is used to find the hyperbolic tangent of an given input angle passed to it as a parameter. The hyperbolic tangent of any argument X is equal to “sinh(X) / cosh(X)”. It accepts only a single parameter $number which is the given number whose hyperbolic tangent value is to be found. Its parameter value must be in radians.

Syntax:

  tanh($number);

Parameter Values

Parameter Description
number This is a required parameter. This parameter defines the given input argument.

Here is an example of tanh() function in PHP:

<html>
<body>

<?php

echo tanh(0)."<br>";
echo tanh(1)."<br>";
echo tanh(1.5)."<br>";
echo tanh(-1)."<br>";

?>

</body>
</html>
Output:
0
0.76159415595576
0.90514825364487
-0.76159415595576

Here is another example of tanh() function in PHP:

<html>
<body>

<?php

echo tanh(0)."<br>";
echo tanh(pi()/6)."<br>";
echo tanh(pi()/4)."<br>";
echo tanh(pi()/3)."<br>";

?>

</body>
</html>
Output:
0
0.48047277815645
0.65579420263267
0.78071443535927