PHP-Nut Posted June 25, 2009 Share Posted June 25, 2009 <?php $number = 123.45; echo round(number_format($number,2),0)-0.01;?> echos out 122.99 as expected but........ <?php $number = 1234.56; echo round(number_format($number,2),0)-0.01;?> echos out 0.99 why is this happening? it seams anything that goes over 999.99 causes the round to mess up? what am i doing wrong? Quote Link to comment Share on other sites More sharing options...
PHP-Nut Posted June 25, 2009 Author Share Posted June 25, 2009 <?php $number = 1234.56; echo number_format(round($number,0)-0.01,2);?> SOLVED 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.