Is php deg2rad () equal to mysql radians ()

Are these functions the same? If not, then what corresponds to the corresponding php equivalent of mysql radians()

+7
sql php mysql trigonometry
source share
2 answers

Judging by their documents ( deg2rad , radians ), they seem to be doing the same thing.

And a quick check on a simple test case:

 mysql> select radians(0), radians(45), radians(90); +------------+-------------------+-----------------+ | radians(0) | radians(45) | radians(90) | +------------+-------------------+-----------------+ | 0 | 0.785398163397448 | 1.5707963267949 | +------------+-------------------+-----------------+ 1 row in set (0,00 sec) 

And, in PHP:

 var_dump(deg2rad(0), deg2rad(45), deg2rad(90)); 

also gives:

 float 0 float 0.785398163397 float 1.57079632679 

So it looks like they are doing the same ...

+27
source share

Documentation consulting:

... so yes, they are equivalent.

Was there anything more specific that you were looking for?

+5
source share

All Articles