PHP tanh() Function

Definition and Usage

The tanh() function returns the hyperbolic tangent.

Syntax

tanh(x)
Parameter Description
x Required. A number.

Description

Returns x The hyperbolic tangent value, defined as sinh(arg)/cosh(arg).

Example

In this example, we will return the hyperbolic tangent of different numbers:

<?php
echo(tanh(M_PI_4));
echo(tanh(0.50));
echo(tanh(-0.50));
echo(tanh(5));
echo(tanh(10));
echo(tanh(-5));
echo(tanh(-10))
?>

Output:

0.655794202633
0.46211715726
-0.46211715726
0.999909204263
0.999999995878
-0.999909204263
-0.999999995878