• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

PHP asin function – Arc sine

by admin

Description

The asin() function calculates the arc sine value of the number provided as its only parameter, essentially reversing the operation of sine(). The return value is in radians—you should use the rad2deg() to convert radians to degrees.

$asin1 = asin(0.4346);
$asin2 = asin(sin(80));

Syntax:

asin(float $num): float

Parameters

Parameter Description
num The argument to process.

Return Values

The arc sine of num in radians.

Examples

Example 1:

$sin = 0.75; 
echo "The arcsine of $sin is ", asin($sin); 

Example 2:

<?php
    $arg = 0.5;
    $val = asin($arg);
    echo "asin(" . $arg . ") = " . $val . " radians.<br/>";
    echo "Pi value = " . pi() . "<br/>";  
    echo "asin(" . $arg . ") = " . $val/pi()*180 . " degrees<br/>";
?>

Example 3:

<?php
    $arg = 1;
    $val = asin($arg);
    echo "asin(" . $arg . ") = " . $val . " radians.<br/>";
    echo "Pi value = " . pi() . "<br/>";  
    echo "asin(" . $arg . ") = " . $val/pi()*180 . " degrees<br/>";
?>

Filed Under: PHP

Some more articles you might also be interested in …

  1. PHP base_convert function – Convert a number between arbitrary bases
  2. PHP function str_repeat() – Repeat a string
  3. PHP atan function – Arc tangent
  4. How to test a PHP script
  5. PHP connection_status function – Returns connection status bitfield
  6. PHP Function strchr() – Alias of strstr()
  7. PHP function str_ireplace() – Case-insensitive version of str_replace()
  8. PHP function strcasecmp() – Binary safe case-insensitive string comparison
  9. PHP function chop() – Alias of rtrim()
  10. PHP function abs – Absolute value

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright