How Can I echo asin?

So, I have this php book and I’m just trying out all the different functions that are built inside of PHP and I’ve gotten stuck on asin().

What I’m trying to do is have user input on the number of choice, it would then go through the asin function and give them the answer, but all I am receiving is “NAN”.

This is what I have:

[php]
$num = $_POST[‘num’];
$asin = asin($num);

if(isset($num)) {
echo “Answer: $asin”;
} else {
echo "Answer: ";
}[/php]

Thanks in advance!

asin() ‘Returns the arc sine in radians’. That means (going back to my A-level maths) that the number given to the function has to be between 0 and 1. Any number larger than 1 or smaller than 0 returns NaN (Not A Number)

Sponsor our Newsletter | Privacy Policy | Terms of Service