PHP deg2rad()

ernestsadowski's avatar
Published Jul 10, 2023
Contribute to Docs

The deg2rad() function converts a number in degrees to the radian equivalent.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours

Syntax

$result = deg2rad(n);

Where n is the number in degrees to be converted to the radian equivalent.

The result returns a value type of float.

Example

Using deg2rad() to convert degrees to radians:

<?php
echo deg2rad(90);
?>

This example results in the following output:

1.5707963267949

All contributors

Contribute to Docs

Learn PHP on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours