The tanh()
function returns the hyperbolic tangent of a number,
which is equal to sinh(x)/cosh(x).
PHP tanh() Function has the following syntax.
tanh(number);
Parameter | Is Required | Description |
---|---|---|
number | Required. | Specifies a number |
Return | Description |
---|---|
Return Value | The hyperbolic tangent of number |
Return Type | Float |
Return the hyperbolic tangent of different numbers:
<?php
echo(tanh(M_PI_4) . "\n");
echo(tanh(0.5) . "\n");
echo(tanh(-0.5) . "\n");
echo(tanh(5) . "\n");
echo(tanh(1) . "\n");
echo(tanh(-1) . "\n");
echo(tanh(-10));
?>
The code above generates the following result.