X is the angular value in radian. We get output as cosine of the input angle.
echo COS(PI()); // Output is -1
echo "<br>";
echo COS(PI()/2); // Output  6.1232339957368E-17 // Same as 0 
echo "<br>";
echo COS(PI()/3); // Output is 0.5
echo "<br>";
echo COS(PI()/4); // Output is 0.70710678118655 

deg2rad() with COS()

We can use deg2rad() to convert Degree value to radian and then use COS().
echo cos(deg2rad(0)); // Output  is 1
echo "<br>";
echo cos(deg2rad(180)); // Output  is -1

Plotting of SIN & COS curves by using PHP GD function with deg2rad()

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer