Page 1 of 1

PHP + Math Logic [Easy]

Posted: Sun Jun 17, 2007 12:35 am
by tecktalkcm0391
My brain is dead right now :? ... How can I figure out how many pounds and ounces are in x knowing 1 pound = 16 ounces. I want php to convert say 234 ounces to whatever pounds and y ounces.

Thanks:!:

Posted: Sun Jun 17, 2007 12:45 am
by Benjamin
Your either way tired or you smoke tooooo much weed.

Posted: Sun Jun 17, 2007 12:49 am
by Benjamin

Code: Select all

$pounds = floor($ounces / 16);
$ounces = $ounces - ($pounds * 16);
I'm tired too, but that should work.

Posted: Sun Jun 17, 2007 12:50 am
by tecktalkcm0391
astions wrote:Your either way tired or you smoke tooooo much weed.
It's definitely the way tired.

Posted: Sun Jun 17, 2007 12:53 am
by tecktalkcm0391
astions wrote:

Code: Select all

$pounds = floor($ounces / 16);
$ounces = $ounces - ($pounds * 16);
I'm tired too, but that should work.
Thanks! Worked.
Now I'm off to bed. :wink: