Hailwood Posted July 14, 2010 Share Posted July 14, 2010 hi there, well here is what i am doing: $flybuys: 6014359000000928 $check: 8 $total = (array_sum($odds))+$evens; $total = str_split($total); $check = 10 - $total[1]; echo $flybuys.' % '.$check.': '.$flybuys % $check.'<br />'; $res = $flybuys % $check; echo 'res: '.$res; and the output is: 6014359000000928 % 8: 7 res: 7 yet if i do: echo 6014359000000928 % 8; i get: 0;, which is correct so where is the 7 coming from? Link to comment https://forums.phpfreaks.com/topic/207696-6014359000000928-8-7/ Share on other sites More sharing options...
Mchl Posted July 14, 2010 Share Posted July 14, 2010 6014359000000928 is larger than 32 bit integer, so PHP casts it to float. This may result in unexpected results. For numbers like this use bc_math functions. Link to comment https://forums.phpfreaks.com/topic/207696-6014359000000928-8-7/#findComment-1085803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.