PHP Negative Value to Positive Value

Author: Zeeshan Arshad     1146     09/09/2015

Estimated reading time: 0 minutes, 14 seconds

Converting a number from negative to positive is a pretty simple process using the absolute function abs():

$value = abs(-123); // = 123
$value = abs(123); // also = 123

Absolute returns a positive integer or float based. It only returns a positive value, you don't have to worry about what number is going in.


Was this topic helpful?

Yes
No
Subscribe YouTube Channel

Zeeshan is a multi-talented serial freelacncer, specialist in custom apps/cms/automation scripts and online instructor.

Feel free to contact him with your clear message or problem.

Story  LinkedIn Profile  Courses  YouTube