
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
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
- Related Articles
- asin() function in PHP
- asin() function for complex number in C++?
- PHP Function arguments
- PHP abs() Function
- PHP acos() Function
- PHP acosh() Function
- PHP asinh() Function
- PHP atan() Function
- PHP atan2() Function
- PHP atanh() Function
- PHP base_convert() Function
- PHP bindec() Function
- PHP ceil() Function
- PHP cos() Function
- PHP cosh() Function
