PHP Tutorial - PHP asin() Function






Definition

The asin() function calculates the arc sine value, It reverses the operation of sine().

Syntax

PHP asin() Function has the following syntax.

float asin ( float num )

Parameter

Parameter Is Required Description
num Required. Specifies a number in range -1 to 1

Return

The return value is in radians. We can use the rad2deg() to convert radians to degrees.

asin(1) returns the value of Pi/2.

Example

Calculate the arc sine value

 
<?php// www  .  j av  a2 s.c om
$asin1 = asin(0.46); 
print($asin1);
$asin2 = asin(sin(8));
print($asin2);

echo(asin(0.4) . "\n");
echo(asin(-0.4) . "\n");
echo(asin(0) . "\n");
echo(asin(-1) . "\n");
echo(asin(1) . "\n");
echo(asin(2));
?>

The code above generates the following result.