asin() accepts a value from -1 through 1 and returns the corresponding angle in radians.
$angle = asin(0.5);
echo rad2deg($angle); // approximately 30
Start with this current pattern. The examples below are retained for additional variations, output and reference.
<?Php
echo asin(0); // Output is 0
echo "<br>";
echo asin(1); // Output 1.5707963267949
echo "<br>";
echo asin(-1); // Output is -1.5707963267949
echo "<br>";
echo asin(4); // Output is NAN
?>
Syntax
asin(X);
X is the angular value in radian. We get output as ARC SIN of the input angle. It is X==sin(asin(X)) <?Php
echo asin(deg2rad(0)); // 0
echo "<br>";
echo asin(deg2rad(1)); // 0.017454178737585
echo "<br>";
echo asin(deg2rad(-1)); // -0.017454178737585
?>
The *asin()* function can also be used to find the inverse sine of a negative value:
$value = -0.5;
$result = asin($value);
echo "The arcsin of $value is: " . $result;
// Outputs: The arcsin of -0.5 is: -0.5235987755983
To convert the result from radians to degrees:
$value = 0.5;
$radians = asin($value);
$degrees = rad2deg($radians);
echo "The arcsin of $value in degrees is: " . $degrees;
// Outputs: The arcsin of 0.5 in degrees is: 30
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.