12

Are these functions the same? If not, what is an appropriate php equivalent to mysql's radians()

robjmills
  • 18,438
  • 15
  • 77
  • 121
JLeonard
  • 8,520
  • 7
  • 36
  • 36

2 Answers2

31

Judging from their documentations (deg2rad, radians), they seem to do the same.

And a quick verification 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 seems they do quite the same...

Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
7

Consulting the documentation:

...so yes, they are equivalent.

Was there something more specific you were looking for?

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502