PHP abs()

StevenSwiniarski's avatar
Published Apr 20, 2023
Contribute to Docs

The abs() function returns the absolute value of the argument.

  • 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 = abs(n);

Where n is the number to find the absolute value of.

Codebyte Example

Using abs() to return the absolute value of -6.5:

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