![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
deg2rad() function in PHP
The deg2rad() function converts degree to radian value. It Returns the radian equivalent of the specified degree value.
Syntax
deg2rad(num)
Parameters
num − The degree value to be converted to radian.
Return
The deg2rad() function Returns the radian equivalent of the specified degree value.
Example
<?php $degVal = 360; $radVal = deg2rad($degVal); echo "$degVal degrees converted to $radVal radians!"; ?>
Output
360 degrees converted to 6.2831853071796 radians!
Let us see another example −
Example
<?php echo deg2rad("45") . "<br>"; echo deg2rad("90") . "<br>"; echo deg2rad("180") . "<br>"; echo deg2rad("270") . "<br>"; echo deg2rad("360"); ?>
Output
0.78539816339745<br>1.5707963267949<br>3.1415926535898<br>4.7123889803847<br>6.2831853071796
Advertisements