

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
abs() function in PHP
The abs() function returns the absolute value of a number.
Syntax
abs(num)
Parameters
num − The number for which we want to get the absolute value. If the num is float, then the return type will be float, otherwise it is an integer.
Return
The abs() function returns the absolute value of the specified number.
Example
<?php echo(abs(3.1) . "<br>"); echo(abs(-9.7) . "<br>"); ?>
Output
3.1<br>9.7<br>
Let us see another example −
Example
<?php echo(abs(20) . "<br>"); echo(abs(-50) . "<br>"); ?>
Output
20<br>50<br>
- Related Questions & Answers
- PHP abs() Function
- abs() function for complex number in c++ ?
- abs() in Python
- Duration abs() method in Java
- Python - fabs() vs abs()
- abs(), labs(), llabs() functions in C/C++
- file_exists() function in PHP
- basename( ) function in PHP
- chgrp()function in PHP
- chmod() function in PHP
- chown() function in PHP
- clearstatcache() function in PHP
- copy() function in PHP
- delete() function in PHP
- dirname()function in PHP
Advertisements