PHP Function Reference

PHP asin() Function



The PHP asin() function returns arc sine of a value. The returned value will be in the range -𝜋/2 through 𝜋/2. In special cases it returns the following:

  • If the argument is NAN or its absolute value is greater than 1, then the result is NAN.

Note: asin() is the inverse of sin().

Syntax

asin(number)

Parameters

number Required. Specify the value.

Return Value

Returns the arc sine of the value.

Example:

In the example below, asin() function is used to find out the arc sine of a given value.

<?php
echo "asin(-1) = ".asin(-1)."\n";
echo "asin(-0.5) = ".asin(-0.5)."\n";
echo "asin(0) = ".asin(0)."\n";
echo "asin(0.5) = ".asin(0.5)."\n";
echo "asin(1) = ".asin(1)."\n";
echo "asin(2) = ".asin(2)."\n";
echo "asin(NAN) = ".asin(NAN)."\n";
?>

The output of the above code will be:

asin(-1) = -1.5707963267949
asin(-0.5) = -0.5235987755983
asin(0) = 0
asin(0.5) = 0.5235987755983
asin(1) = 1.5707963267949
asin(2) = NAN
asin(NAN) = NAN

❮ PHP Math Reference