PHP rad2deg() Function

Definition

The rad2deg() function converts radians to degrees. Radians are calculated as being $degrees multiplied by the mathematical constant pi, then divided by 180.

Syntax

PHP rad2deg() Function has the following syntax.

float rad2deg ( float number )

Parameter

ParameterIs RequiredDescription
numberRequired. A radian value to convert

Return

Item Description
Return ValueThe equivalent of number in degrees
Return Type Float

Example

Convert radians to degrees:


/*from   w  w  w.j  av a  2 s. c o m*/
<?php
echo rad2deg(pi()) . "\n";
echo rad2deg(pi()/4) . "\n";

$atan_deg = rad2deg(atan(0.46)); 
echo $atan_deg;
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions