Negative numbers to positive php

❮ PHP Math Reference

Example

Return the absolute value of different numbers:

Try it Yourself »

Definition and Usage

The abs[] function returns the absolute [positive] value of a number.

Syntax

Parameter Values

ParameterDescription
number Required. Specifies a number. If the number is of type float, the return type is also float, otherwise it is integer

Technical Details

Return Value:Return Type:PHP Version:
The absolute value of the number
Float / Integer
4+

❮ PHP Math Reference


A trivial

$num = $num 

Chủ Đề