PHP rad2deg() Function Last Updated : 22 Jun, 2023 Comments Improve Suggest changes Like Article Like Report Measurement of Angle is one of the foundation stones of Geometry and Trigonometry, and the two most commonly used methods of measurement are Degrees and Radians. Because of it's simplicity many prefer to use degree over Radian. Some of the reasons that makes degrees more preferable are: Degrees may not be much efficient while calculating derivatives or complicated relations, but it is easy to understand and visualize. While Radian is in fact a ratio, Degree is considered as the unit of rotational displacement where a complete rotation is equivalent to 360 Degrees. Because of this simplicity students are taught and are much more familiar to Degrees rather than Radians. Thus in some cases we may require to convert from radians to degrees, this is where the method rad2deg() comes in aid. Syntax: float rad2deg($value) Parameters: The function takes a single parameter $value which is of type float that represents an angle in Radians. Return Type: This function returns a float value that represents the Degree equivalent of the given angle $value. Examples: Input : $value = M_PI_4; Output : 45 Input : $value = M_PI_2; Output : 90 Input : $value = M_PI; Output : 180 Below program illustrates the working of rad2deg() in PHP: PHP <?php // PHP code to illustrate the working of rad2deg() $rad = M_PI; $k = 1; for(;$k<=8;$k*=2, $rad/=2) { if($k!=1) echo 'pi/'.$k.' = '.rad2deg($rad)."\n"; else echo 'pi = '.rad2deg($rad)."\n"; } ?> Output: pi = 180 pi/2 = 90 pi/4 = 45 pi/8 = 22.5 Important points to note: It calculates the Degrees equivalent of the angle given in Radians. The counterpart of the method is rad2deg(). This method produces highly accurate results but is not much time efficient. Reference: http://php.net/manual/en/function.rad2deg.php Comment More infoAdvertise with us Next Article PHP rad2deg() Function P PronabM Follow Improve Article Tags : Misc Web Technologies PHP PHP-math PHP-function +1 More Practice Tags : Misc Similar Reads PHP | XMLReader read() Function The XMLReader::read() function is an inbuilt function in PHP which is used to move to next node in document. Thus this function is used to traverse through the XML document. Syntax: bool XMLReader::read( void ) Parameters: This function doesnât accepts any parameter. Return Value: This function retu 2 min read PHP | time() Function The time() function is a built-in function in PHP which returns the current time measured in the number of seconds since the Unix Epoch. The number of seconds can be converted to the current date using date() function in PHP. Syntax: int time() Parameter: This function does not accepts any parameter 2 min read PHP String Functions Strings are a fundamental data type in PHP, used to store and manipulate text. PHP provides a wide variety of built-in string functions. These functions perform various operations such as string transformations, character manipulations, encoding and decoding, and formatting, making string handling s 6 min read PHP | sleep( ) Function The sleep() function in PHP is an inbuilt function which is used to delay the execution of the current script for a specified number of seconds. The sleep( ) function accepts seconds as a parameter and returns TRUE on success or FALSE on failure. If the call is interrupted by a signal, sleep() funct 2 min read PHP | lcg_value() Function The lcg_value() function is an inbuilt function in PHP which is used to generate the pseudo-random number in the range of (0, 1). Syntax: lcg_value() Parameters Used: This function does not take any parameters. Return Values: This function returns A pseudo random float value in a range between 0 and 1 min read PHP | print_r() Function The print_r() function is a built-in function in PHP and is used to print or display information stored in a variable. Syntax: print_r( $variable, $isStore ) Parameters: This function accepts two parameters as shown in above syntax and described below. $variable: This parameter specifies the variabl 2 min read PHP vprintf() function The vprintf() function in PHP is an inbuilt function which is used to display array values as a formatted string Display array values as a formatted string according to format it is work similar as printf() but accepts an array of arguments, in place of variables number of arguments. Returns the len 5 min read PHP fdiv() Function The fdiv() is an inbuilt PHP function that returns the result of a division of 2 numbers(in accordance with IEEE 754). The NaN will never == or === for any value while doing the comparison, even including itself. Syntax: fdiv(float $num1, float $num2): floatParameters: This function accepts 2 parame 1 min read PHP | exit( ) Function The exit() function in PHP is an inbuilt function which is used to output a message and terminate the current script. The exit() function only terminates the execution of the script. The shutdown functions and object destructors will always be executed even if exit() function is called. The message 2 min read Like