• 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 atan2 function – Arc tangent of two variables

by admin

Description

This function returns the value of the arctangent of the point denoted by the x and y parameters. The return value is in radians, in the range -pi to pi (approximately -3.14 to 3.14). It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

Syntax:

atan2(float $y, float $x): float

Parameters

Parameter Description
y Dividend parameter
x Divisor parameter

Return Values

The arc tangent of y/x in radians.

Examples

Example 1:
Calculate the arctangent of a coordinate:

$tanx = -1; 
$tany = 1; 
echo "The arctangent of $tanx/$tany is ", atan2($tanx, $tany)

Filed Under: PHP

Some more articles you might also be interested in …

  1. PHP Function strchr() – Alias of strstr()
  2. PHP base_convert function – Convert a number between arbitrary bases
  3. PHP function str_repeat() – Repeat a string
  4. PHP function stripcslashes() – Un-quote string quoted with addcslashes()
  5. PHP function stripslashes() – Un-quotes a quoted string
  6. PHP atanh function – Inverse hyperbolic tangent
  7. PHP Function strncasecmp() – Binary safe case-insensitive string comparison of the first n characters
  8. PHP asin function – Arc sine
  9. PHP Function str_word_count() – Return information about words used in a string
  10. PHP decbin function – Decimal to binary

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