PHP cos()

Anonymous contributor's avatar
Anonymous contributor
Published Jun 17, 2023
Contribute to Docs

The cos() function returns the cosine of the angle passed as the argument. The return value is a floating-point number.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours

Syntax

$result = cos($angle);

Where $angle is the angle in radians.

Codebyte Example

Using cos() to return the cosine of the angle in radians:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn PHP on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours