Negative Interger to positive.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Etherguy
Forum Commoner
Posts: 70
Joined: Fri Nov 01, 2002 9:09 pm
Location: Long Island, New York

Negative Interger to positive.

Post by Etherguy »

I know I am going to be kicking myself for this one, but how would I go about displaying a negative integer as a positive?

What I am trying to do is print the difference in weight as a whole number. Either you lost 5 pounds or you gained 5 pounds. Simple math, but looks funny saying hey there fatso you gained -5 pounds instead of great job you lost 5.

Any help would be greatly appreciated.

Regards.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

$absolute_value=abs($number)
User avatar
Etherguy
Forum Commoner
Posts: 70
Joined: Fri Nov 01, 2002 9:09 pm
Location: Long Island, New York

Post by Etherguy »

Thanks... new I would be kicking myself.

Regards.
Post Reply