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? Link to comment https://forums.phpfreaks.com/topic/163634-using-round-number_format/ 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 Link to comment https://forums.phpfreaks.com/topic/163634-using-round-number_format/#findComment-863393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.