Jump to content

ignore + and -


RON_ron

Recommended Posts

I assume you meant that you only want to "ignore" the negative by just echoing  75.  Assuming that's the case, then convert  the negative number  to a positive and echo that value:

 

$val = 150 - 225;
$val = abs($val);
echo $val;

 

The abs function converts a positive to a negative.  See the following:

www.php.net/abs

Link to comment
https://forums.phpfreaks.com/topic/218915-ignore-and/#findComment-1135327
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.