Definition and Usage
The sinh() function calculates hyperbolic sine of given angle in radians. A hyperbolic sine function is defined as
sinh(x) = (ex – e-x))/2
This function returns a float value between Π and -Π.
Syntax
sinh( float $arg ) : float
Parameters
Sr.No | Parameter & Description |
---|---|
1 | arg A floating point value that represents angle in radians |
Return Values
PHP sinh() function returns hyperbolic sine ratio of given parameter.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
Following example calculates sinh(pi/2) and returns 2.3012989023073 which is also the result of formula (ex – e-x))/2−
<?php $arg=M_PI_2; $val=(exp($arg)-exp(-$arg))/2; $res=sinh($arg); echo "sinh(M_PI_2) = " . $val. "\n"; echo "using formula = " . $res . "\n"; ?>
Output
This will produce following result −
sinh(M_PI_2) = 2.3012989023073 using formula = 2.3012989023073
Example
Following example uses deg2rad() function to convert degrees to radians and then uses sinh(30) −
<?php $arg=deg2rad(30); $val=sinh($arg); echo "sinh(" . $arg . ") = " . $val; ?>
Output
This will produce following result −
sinh(0.5235987755983) = 0.54785347388804
Example
Let's check find out sinh(0). It returns 0 −
<?php $arg=0; $val=sinh($arg); echo "sinh(" . $arg . ") = " . $val; ?>
Output
This will produce following result −
sinh(0) = 0
Example
Following example computes sinh(pi)
<?php $arg=M_PI; // pi $val=sinh($arg); echo "sinh(" . $arg . ") = " . $val; ?>
Output
This will produce following result −
sinh(3.1415926535898) = 11.548739357258