1. Home
  2. Computing & Technology
  3. PHP / MySQL
Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

Radians to Degrees

Thursday July 2, 2009
In PHP you can convert angles measured in radians to degrees using the Rad2Deg () PHP Function. Here is an example that shows that 1/2 PI radians is equal to 90 degrees:

echo(rad2deg(M_PI_2);

This returns the result: 90
Comments
July 8, 2009 at 3:55 am
(1) Magnus says:

Now, i’m not sure about this as i haven’t tested it, but wouldn’t your code generate a syntax error?

I believe the correct code would be echo(rad2deg(M_PI_2));
or
echo rad2deg(M_PI_2);

July 9, 2009 at 1:01 am
(2) Mahbub says:

Isn’t there any quotation need to use?
like
echo “rad2deg(M PI 2)”;

July 9, 2009 at 2:15 am
(3) Magnus says:

Normally it would be:
echo function(”value”);
but not here, se http://nl.php.net/rad2deg

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.