How does changing the calculator from DEG to RAD affect the calculation results in PHP?

Changing the calculator from DEG (degree mode) to RAD (radian mode) affects the calculation results by interpreting angles differently. In DEG mode, trigonometric functions like sin, cos, and tan expect input angles to be in degrees, while in RAD mode, they expect input angles to be in radians. To ensure accurate calculations, it's important to set the calculator mode to the appropriate unit (DEG or RAD) based on the input data.

// Set the calculator mode to RAD (radian mode) for accurate trigonometric calculations
ini_set('precision', 14); // Set the precision for trigonometric functions

$angle_deg = 45; // Angle in degrees
$angle_rad = deg2rad($angle_deg); // Convert angle from degrees to radians

// Calculate sine of the angle in RAD mode
$sine_value = sin($angle_rad);

echo "Sine of $angle_deg degrees in RAD mode is: $sine_value";