- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP asin() Function
Definition and Usage
The asin() function returns the arc sine or sine inverse of arg in radians. asin() is the inverse function of sin(). Therefore if sin(x)=y, asin(y)=x.
For example, sin(pi/2)=1 and asin(1)=1.57079633 rad which is equal to pi/2.
This function returns a float value.
Syntax
asin ( float $arg ) : float
Parameters
Sr.No | Parameter & Description |
---|---|
1 | arg A floating point number whose arc sine is to be calculated. Number should be withing -1 to 1 |
Return Values
PHP asin() function returns arc sine of given number. It is angle represented in radians.
PHP Version
This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.
Example
Following example calculates asin(0.5) and returns 0.5235987755983 radians which is equivalent to pi/6 −
<?php $arg=0.5; $val=asin($arg); echo "asin(" . $arg . ") = " . $val . " radians"; ?>
Output
This will produce following result −
asin(0.5) = 0.5235987755983 radians
Example
Following example calculates asin(0) and returns 0 radians which is equivalent to sin(0) −
<?php $arg=0; $val=asin($arg); echo "asin(" . $arg . ") = " . $val . " radians"; ?>
Output
This will produce following result −
asin(0) = 0 radians
Example
Let's check find out asin(-1). It returns -1.5707963267949 radians (which is -pi/2) −
<?php $arg=-1; $val=asin($arg); echo "asin(" . $arg . ") = " . $val . " radians"; ?>
Output
This will produce following result −
asin(-1) = -1.5707963267949 radians
Example
Following example returns NAN as the argument number is not within -1 to 1
<?php $arg=5; $val=asin($arg); echo "asin(" . $arg . ") = " . $val . " radians"; ?>
Output
This will produce following result −
asin(5) = NAN radians
To Continue Learning Please Login
Login with Google