What are the potential pitfalls when working with trigonometric functions in PHP?

When working with trigonometric functions in PHP, one potential pitfall is ensuring that the input to these functions is in the correct units (radians or degrees). Failure to convert the input to the correct unit can result in incorrect calculations. To avoid this issue, always make sure to convert the input to the appropriate unit before using trigonometric functions.

// Convert degrees to radians before using trigonometric functions
$angle_degrees = 45;
$angle_radians = deg2rad($angle_degrees);

// Calculate sine of the angle
$sin_angle = sin($angle_radians);

echo "Sine of $angle_degrees degrees is: $sin_angle";