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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

PHP function acos – Arc cosine

by admin

Description

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

$acos1 = acos(0.4346);
$acos2 = acos(cos(80));

Syntax:

acos(float $num): float

Parameters

Parameter Description
num The argument to process

Return Values

The arc cosine of num in radians.

Example

Calculate the arccosine of a value

$cos = 0.5; 
echo "The arccosine of $cos is ", acos($cos); 

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 decbin function – Decimal to binary
  3. PHP bindec function – Convert a number between arbitrary bases
  4. PHP asin function – Arc sine
  5. PHP function bin2hex – Convert binary data into hexadecimal representation
  6. PHP ceil function – Round fractions up
  7. PHP function str_replace() – Replace all occurrences of the search string with the replacement string
  8. PHP cos function – Cosine
  9. PHP Function strchr() – Alias of strstr()
  10. PHP function strcmp() – Binary safe string comparison

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright