Backend Development 2 min read

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.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP cosh() Function – Hyperbolic Cosine

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.74676148375
Backend Developmentphpcoshhyperbolic cosinemath functions
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

login 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.