w3resource

PHP: tanh() function

Description

The tanh() function returns the hyperbolic tangent of a number.

Version:

(PHP 4 and above)

Syntax:

tanh(num)

Parameter:

Name Description Required /
Optional
Type
num A number. Required Float

Return value:

The hyperbolic tangent of num.

Value Type: Float.

Example:

<?php
$val1= 0;
$val2=5;
$val3=-10;
$val4= M_PI_4;
$ztanh1=tanh($val1);
$ztanh2=tanh($val2);
$ztanh3=tanh($val3);
$ztanh4=tanh($val4);
echo "Hyperbolic tangent of $ztanh1 is $ztanh1<br />";
echo "Hyperbolic tangent of $ztanh2 is $ztanh2<br />";
echo "Hyperbolic tangent of $ztanh3 is $ztanh3<br />";
echo "Hyperbolic tangent of $ztanh4 is $ztanh4<br />";
?> 

Output:

Hyperbolic tangent of 0 is 0
Hyperbolic tangent of 0.9999092042626 is   0.9999092042626
Hyperbolic tangent of -0.99999999587769 is   -0.99999999587769
Hyperbolic tangent of  is 

View the example in the browser

See also

PHP Function Reference

Previous: tan
Next: String



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/tanh.php