Content · Programming · PHP

PHP acosh() Function: Usage and Examples

Learn how PHP acosh works with practical examples, important behavior, relevant alternatives and common mistakes.

1 views Published Oct 16, 2026 Updated Oct 16, 2026

Calculates the inverse hyperbolic cosine.

What Is acosh() in PHP?

Calculates the inverse hyperbolic cosine.

Its syntax is:

acosh(float $num): float

Parameters:

  • $num — Accepted as float; required argument.

Return type: float. The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Availability: Available in standard PHP.

Example 1: Basic Usage

<?php

echo acosh(1);

Output:

0

The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Example 2: A Different Input

<?php

echo round(acosh(2), 4);

Output:

1.317

The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Practical Example: Applying It in a Program

<?php

$measurements = [1.0, 1.5, 3.0];
foreach ($measurements as $measurement) { echo round(acosh($measurement), 3) . PHP_EOL; }

Output:

0
0.962
1.763

The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Important Behavior and Edge Cases

  • Key behavior: The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().
  • Environment: Available in standard PHP.

Comparison With Related Functions

FunctionPurpose
acosh()calculates the inverse hyperbolic cosine.
acos()acos() accepts a cosine value within -1 to 1; acosh() accepts a hyperbolic cosine value of at least 1.

Common Beginner Mistakes

MistakeCorrect Approach
Ignoring this behavior: The real-number domain starts at 1The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Key Takeaways

  • calculates the inverse hyperbolic cosine.
  • The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().
  • Available in standard PHP.

Summary: The real-number domain starts at 1. Values below 1 produce NAN. This function is not the same as acos().

Share this resourceSend this page to someone who may find it useful.