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 Link to comment https://forums.phpfreaks.com/topic/119532-please-explain-syntax/ 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. Link to comment https://forums.phpfreaks.com/topic/119532-please-explain-syntax/#findComment-615782 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 Link to comment https://forums.phpfreaks.com/topic/119532-please-explain-syntax/#findComment-615794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.