The cosh()
function in PHP returns the hyperbolic cosine of a number in radians.
The following illustration shows the mathematical representation of the cosh()
function.
cosh(float $num): float
As a parameter, this function requires a number that represents an angle in radians.
To convert degrees to radians, use the following formula.
radians = degrees * ( M_PI / 180.0 )
cosh()
returns the hyperbolic cosine of a number (in radians) that is sent in as a parameter.
If the value of num
is NaN
.
If the value of num
is positive/negative infinity, then the return value is positive infinity
.
<?php#Positive number in radiansecho("cosh(2.3): ");echo (cosh(2.3));?><?php#Negative number in radiansecho("cosh(-2.3): ");echo (cosh(-2.3));?><?php#converting the degrees angle into radians and then applying cosh()#degrees = 180echo("cosh(180 * (M_PI / (180))): ");echo (cosh(180 * (M_PI / (180))));?>