Re: [PHP] Why doesn't working with array's ever stick in my thick head?
[email protected] (Roberto Mansfield)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
Jason Pruim wrote: >> Why do you want tenth's of pounds? Just divide pounds by 16 and you'll >> get ounces. > > It's actually for a weight calculator that we use for some of our > mailings. when you take .226 and multiply that by 464 you get 104.864 > ounces. > > I need to be able to display that as: 6 # 13.824 Ounces. Then I think you want to use the mod operator: (I'm assuming .226 is the cost per ounce and 464 is the total number of ounces) $pounds = intval( .226 * 464 / 16 ); $ounces = ( .226 * 464 ) % 16; Roberto