Using this method, calculates the tangent of two variables.
PHP atan2() Function Example:
Using this method, calculates the tangent of two variables. The atan2() takes two arguments and return tangent after calculating it.
Syntax:
atan2(a, b)
where a and b are two numbers.
Example:
<?php $return = atan2(1, 2); echo "The value of atan2(1, 2) is : " . $return . "<br />"; $return_value1 = atan2(1.5, 2.5); echo "The value of atan2(1.5, 2.5) is : " . $return_value1 . "<br />"; $return_value2 = atan2(-1.5, -2.5); echo "The value of atan2(-1.5, -2.5) is : " . $return_value2 . "<br />"; ?>
After running this example the output is:
Output:
The value of atan2(1, 2) is : 0.46364760900081 The value of atan2(1.5, 2.5) is : 0.54041950027058 The value of atan2(-1.5, -2.5) is : -2.6011731533192
[ 0 ] Comments