PHP absolute value : abs()Using abs math function we can get absolute value of any number in PHPHere are some examples
Here we are changing all negative numbers to positive numbers.
Changing all negative numbers of an arrayWe can take an array with both negative and positive numbers. We will use array_map() built in PHP function to change all negative elements to positive by using abs function.
Output is here.
This article is written by plus2net.com team.
![]() |