The asin()
function in PHP returns the arc sine (inverse sine) of a number.
It accepts a value between -1 and 1 and returns the angle in radians.
The result lies between -π/2 and +π/2 radians.
Useful for trigonometric calculations, especially in geometry or physics.
You can convert the result to degrees using rad2deg()
.
Syntax
asin(float $num): float
- $num: A float value between -1 and 1
- Returns: The angle in radians, ranging from -π/2 to +π/2
File Name: asin-example.php
<!--?php echo asin(0); // ➤ 0 echo "\n"; echo asin(1); // ➤ 1.5707963267949 (π/2 radians) echo "\n"; echo asin(-1); // ➤ -1.5707963267949 (-π/2 radians) ?-->
Convert Radians to Degrees
$angle = asin(0.5); // Returns radians
$degrees = rad2deg($angle); // ➤ 30
echo $degrees;
Use Cases
Scenario | Description |
---|---|
Trigonometry | Finding angles from sine values |
Geometry | Calculating triangle angles |
Physics/Signal processing | Angle resolution based on sine wave data |
Summary
Function | Description |
---|---|
asin() |
Returns inverse sine (in radians) |
Range | Accepts values from -1 to 1 |
Output | Float value between -π/2 and +π/2 |