PHP rad2deg() Function

In this chapter you will learn:

  1. Definition for PHP rad2deg() Function
  2. Syntax for PHP rad2deg() Function
  3. Parameter for PHP rad2deg() Function
  4. Return for PHP rad2deg() Function
  5. Example - Convert radians to degrees

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   ja v  a2s.  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.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP rand() Function
  2. Syntax for PHP rand() Function
  3. Parameter for PHP rand() Function
  4. Return for PHP rand() Function
  5. Note for PHP rand() Function
  6. Example - Generate Random number
  7. Example - Display Random picture