Jump to content

Convert pounds to ounces.


Ninjakreborn

Recommended Posts

Yeah, PHP provides built-in support for this kind of thing: math. 1 pound = 16 ounces.

 

$ounces = $pounds * 16;

 

Or create a simple function.

 

function pounds_to_ounces($pounds) {
    return $pounds * 16;
}

Link to comment
Share on other sites

According to my tests, that isn't working.

If I do 2.5 (2 and a half pounds) and do 2.5 * 16 it's not calculating out correctly.  That is what I had originally thought when I tried the conversion

the way that was suggested (using standard math) but the values are off for some reason.

Link to comment
Share on other sites

Guest
This topic is now 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.