Can somebody explain this ?
echo ceil( 20.7 * 100 ); // returns 2070
echo ceil( 2070 ); // returns 2070
all OK and logical, but
echo ceil( 40.7 * 100 ); // returns 4071
echo ceil( 4070 ); // returns 4070
not OK and not logical…
Why is this difference ?
Thanks
Floating point numbers issue… you can overcome your problem with something like this: