X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP deg2rad() Function

PHP Math Reference PHP Math Reference

Example

Convert degrees to radians:

<?php
echo deg2rad("45") . "<br>";
echo deg2rad("90") . "<br>";
echo deg2rad("360");
?>

Run example »

Definition and Usage

The deg2rad() function converts a degree value to a radian value.

Tip: To convert a radian value to a degree value, look at the rad2deg() function.


Syntax

deg2rad(number);

Parameter Description
number Required. Specifies the degree to convert

Technical Details

Return Value: The radian equivalent of number
Return Type: Float
PHP Version: 4+


Examples

More Examples

Example 1

 Convert a degree into its radian equivalent:

<?php
$deg = 180;
$rad = deg2rad($deg);
echo "$deg degrees is equal to $rad radians.";
?>

Run example »


PHP Math Reference PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook