deg2rad()

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

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

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