Home >Backend Development >PHP Problem >What does abs in php code mean?

What does abs in php code mean?

藏色散人
藏色散人Original
2019-10-11 11:20:124655browse

What does abs in php code mean?

What does php code abs mean?

Definition and usage of abs function in php

abs() function returns the absolute value of a number.

Syntax

abs(x)

Parameters

x Required. A number.

Description

Returns the absolute value of parameter x. If the parameter x is a float, the return type is also a float, otherwise an integer is returned (because float usually has a larger value range than an integer).

Example

<?php
echo(abs(6.7));
echo(abs(-3));
echo(abs(3));
?>

Output:

6.7
3
3

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of What does abs in php code mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn