PHP tanh()

nikolaspoczekaj's avatar
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.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours

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

Contribute to Docs

Learn PHP on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours