tanh()

Published Jun 21, 2023
Contribute to Docs

The tanh() function in PHP is a mathematical function that returns the hyperbolic tangent of a number. It calculates the ratio of the hyperbolic sine to the hyperbolic cosine of the input value.

Syntax

$result = tanh($number);

$number: The input value for which the hyperbolic tangent will be returned.

Example

In the following example the tanh() function is used to print the tanh of 10:

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

The output will be:

0.99999999587769

All contributors

Looking to contribute?

Learn PHP on Codecademy