PHP tanh() Function – Hyperbolic Tangent

The PHP tanh() function returns the hyperbolic tangent of a float argument, defined as sinh(arg)/cosh(arg), and the article explains its signature, parameters, return value, provides example code snippets, and shows the resulting output values.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP tanh() Function – Hyperbolic Tangent

The tanh() function in PHP returns the hyperbolic tangent of a given float argument, defined as sinh(arg)/cosh(arg).

Signature: float tanh(float $arg) Parameter: $arg – the value to be processed.

Return value: The hyperbolic tangent of $arg as a float.

Example usage:

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

The script outputs the following values respectively:

0.65579420263267
0.46211715726001
-0.46211715726001
0.9999092042626
0.99999999587769
-0.9999092042626
-0.99999999587769
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

hyperbolic tangentmath functiontanh
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.