Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math rad2deg() function is used to convert an angle in radians to an angle in degrees.

Syntax

rad2deg(number)

Parameters

number Required. Specify an angle in radians to convert.

Return Value

The degree equivalent of an angle in radians.

Example:

In the below example, rad2deg() function is used to convert an angle in radians to an angle in degrees.

<?php
echo "rad2deg(PI/6) returns: ".rad2deg(PI()/6)."\n";
echo "rad2deg(PI/3) returns: ".rad2deg(PI()/3)."\n";
echo "rad2deg(PI/2) returns: ".rad2deg(PI()/2)."\n";
?>

The output of the above code will be:

rad2deg(PI/6) returns: 30
rad2deg(PI/3) returns: 60
rad2deg(PI/2) returns: 90

❮ PHP Math Functions