asinh()
Today, we will discuss the asinh() function in PHP. This function is used to get the inverse hyperbolic sine of a number.
The asinh() function returns the inverse hyperbolic sine (also called the area hyperbolic sine) of a number. It is the inverse of sinh(): if sinh($x) equals $y, then asinh($y) returns $x. This page covers its syntax, return value, edge cases, and runnable examples.
Syntax
asinh(float $num): float$num— the value whose inverse hyperbolic sine you want. Any real number is valid, including0and negatives.- Return value — the inverse hyperbolic sine of
$num, expressed in radians.
Mathematically, asinh($num) is defined as log($num + sqrt($num * $num + 1)), so the function never errors for real input — its domain is all real numbers.
A basic example
The call returns the value whose hyperbolic sine is 1.5. You can confirm this is a true inverse by feeding the result back into sinh() — you get 1.5 again.
Inverse relationship with sinh()
Because asinh() undoes sinh(), chaining the two returns the original input (within floating-point rounding):
<?php
$x = 2.0;
echo sinh($x), "\n"; // 3.626860407847
echo asinh(sinh($x)), "\n"; // 2 (the original value)
?>Handling negatives, zero, and non-numeric input
Unlike acosh(), which only accepts values >= 1, asinh() accepts the full range of real numbers. The function is odd, so asinh(-$x) equals -asinh($x):
<?php
echo asinh(0), "\n"; // 0
echo asinh(-1.5), "\n"; // -1.1947632172871
echo asinh(10), "\n"; // 2.998222950298
// A non-numeric string cannot be converted and yields NAN
echo asinh("abc"); // NAN
?>When would you use it?
The inverse hyperbolic sine appears in signal processing, statistics, and physics. A common practical use is the asinh transform, a log-like scaling that, unlike log(), handles zero and negative values gracefully — useful when plotting data that spans several orders of magnitude in both directions.
Related functions
sinh()— hyperbolic sine, the inverse ofasinh().asin()— inverse (arc) sine.acosh()— inverse hyperbolic cosine.atanh()— inverse hyperbolic tangent.