To find the absolute value of a number in php, the easiest way is with the php **abs()** function.

`echo abs(-4); // Output: 4`

Finding the absolute value of a number in php is easy. We can find the absolute number of both integers and floats using the php **abs()** function. The absolute value of a number is the non-negative value of a number.

If a positive number is passed to the **abs()** function, the return value is a positive number.

`echo abs(3); // Output: 3`

If a negative number is passed to the **abs()** function, the return value is a positive number.

`echo abs(-13); // Output: 13`

## Finding the Absolute Value in php of an Integer

In php, we can use the **abs()** function to find the absolute value of an integer. The return value will also be of type integer.

```
echo abs(3); // Output: 3
echo abs(-3); // Output: 3
```

## Finding the Absolute Value in php of a Float

In php, we can also use the **abs()** function to find the absolute value of a float. The return value will also be of type float.

```
echo abs(91.1237); // Output: 91.1237
echo abs(-91.1237); // Output: 91.1237
```

Hopefully this article has been helpful for you to understand how you can find the absolute value of a number in using php.

## Leave a Reply