cosh() function in PHP

The cosh() function in PHP returns the hyperbolic cosine of a number. This mathematical function is useful for calculations involving exponential growth and decay, catenary curves, and engineering applications.

Syntax

cosh(number)

Parameters

  • number − A numeric value for which to calculate the hyperbolic cosine. The value should be in radians.

Return Value

Returns a floating-point number representing the hyperbolic cosine of the input value. The result is always positive since cosh(x) = cosh(-x).

Examples

Basic Usage

Here's how to calculate the hyperbolic cosine of positive and negative values −

<?php
    echo cosh(1) . "<br>";
    echo cosh(-1);
?>
1.5430806348152
1.5430806348152

Using Zero

The hyperbolic cosine of zero is always 1 −

<?php
    echo cosh(0);
?>
1

Using Mathematical Constants

Calculate hyperbolic cosine using PHP's built-in mathematical constants −

<?php
    echo cosh(M_PI) . "<br>";
    echo cosh(2 * M_PI);
?>
11.591953275522
267.74676148375

Key Points

  • The function always returns a positive value

  • cosh(0) = 1

  • cosh(x) = cosh(-x) (even function)

  • Result increases exponentially for larger input values

Conclusion

The cosh() function is essential for hyperbolic calculations in PHP. It returns consistent positive values and is particularly useful in mathematical applications involving exponential relationships.

Updated on: 2026-03-15T07:26:24+05:30

187 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements