Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
domain names
dropshippers
software directory
 Downloads
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Converting from degrees to radians and vice versa


Converting from degrees to radians and vice versa

Unlike many other programming languages php actually has two bult in functions for dealing with radians to degrees and degrees to radians conversions these are rad2deg and deg2rad .

In this simple little example we will show you how to use this time saving pair of functions .

Code :

<?php
$number = 0.986;
$degrees = 32;
//get the cosine of $number
$cos_number = cos($number);
//display the cosine of $number
echo "the cosine of " . $number ." is " . $cos_number;
echo "<br>";
//convert $cos_number to degrees
echo "convert to degrees " . rad2deg($cos_number);
echo "<br>";
//convert $degrees to radians
echo "convert $degrees to radians = " . deg2rad($degrees);
?>

Example :

 

the cosine of 0.986 is 0.552029566065
convert to degrees 31.628964302
convert 32 to radians = 0.558505360638



Books
 Sponsors
 Random Code
A daily MySQL row displayed(database)
Random email addresses(internet)
comedy news feed from the bbc(xml)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials




beginners PHP Copyright © 2004 onwards by beginnersPHP.