atan2

float atan2(float x, float y) 

Returns the arctangent based on an XY coordinate.

Returns:

Arctangent as a float

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).

Version:

PHP 3 since 3.0.5, PHP 4

See also:

acos() 
asin() 
atan() 
cos() 
sin() 
tan() 

Example:

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

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.