Administrators Nabeel Posted December 7, 2009 Administrators Report Share Posted December 7, 2009 For conversions... I suck at these... // Convert units from gallons to lbs if(self::$unit == 'lbs') { $result->jeta = $result->jeta / 6.4; // 6.4 pounds per gallon $result->lowlead = $result->lowlead / 6.4; } elseif(self::$unit == 'kg' || self::$unit == 'kgs') { $result->jeta = ($result->jeta / 6.4) * .45359; $result->lowlead = ($result->lowlead / 6.4) * .45359; } Basically I start with the fuel price, per gallon. Then to convert to price per lb, divide by 6.4. To KG, I convert to lbs, then multiply by .45 to get to kg. This correct, seems right? Quote Link to comment Share on other sites More sharing options...
hjhjhgjgjh Posted December 8, 2009 Report Share Posted December 8, 2009 i cant say if its correct but use the round function or you get like 683.944444444444444444 Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted December 8, 2009 Author Administrators Report Share Posted December 8, 2009 Haha, yep, I will be Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.