webguync Posted August 13, 2008 Share Posted August 13, 2008 echo number_format(($avg/16)*100, 2); in the above syntax, is the , 2 part determining that the resulting number will have 2 decimal places? Also, is order of the algorithm doing the division first and then the multiplication x 100? thx Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 13, 2008 Share Posted August 13, 2008 If you ever don't know what a function parameter does, just PLEASE read the manual. It explains everything. http://us2.php.net/number_format And yes, it's division then multiplication, just look at the parentheses. Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 13, 2008 Share Posted August 13, 2008 even if the parentheses weren't there, PHP follows order of operations as with any other mathematical incarnation (multiplication and division are performed on the same iteration, from left to right in the order they're found). order of operations is a good thing to know whether you're programming or not, FYI. http://en.wikipedia.org/wiki/Order_of_operations 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.