What is the difference between sin() and asin() functions in PHP?
The sin() function in PHP returns the sine of a number, while the asin() function returns the arcsine of a number. The sin() function takes an angle in radians and returns a value between -1 and 1, while the asin() function takes a value between -1 and 1 and returns an angle in radians between -π/2 and π/2.
// Example of using sin() function
$angle = pi() / 2; // 90 degrees in radians
$result = sin($angle);
echo $result; // Output: 1.0
// Example of using asin() function
$value = 0.5;
$result = asin($value);
echo $result; // Output: 0.5235987755983 (approximately 30 degrees in radians)