PHP cosh() Function – Hyperbolic Cosine
The article explains PHP’s built‑in cosh() function, describing its purpose of returning the hyperbolic cosine of a given float argument, detailing the parameter and return value, and providing several example calls with expected numeric outputs.
The cosh() function is a built‑in PHP function that returns the hyperbolic cosine of a numeric argument.
Syntax: float cosh(float $arg)
Description: It computes the value defined as (exp(arg) + exp(-arg)) / 2.
Parameter: $arg – the float value whose hyperbolic cosine is to be calculated.
Return value: The hyperbolic cosine of $arg as a float.
Example usage:
<?php
echo cosh(3)."
";
echo cosh(-3)."
";
echo cosh(0)."
";
echo cosh(M_PI)."
";
echo cosh(2*M_PI);
?>Sample output:
10.067661995778
10.067661995778
1
11.591953275522
267.74676148375Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.