0

I tried to do a simple percentage calculation using PHP and the result is wrong.

$value = floor( (1 - 0.9) * 100 );
echo $value;

Expected result: 10 Actual result: 9

I tried this as well:

$value = floor( ((1 - 0.9) * 100) );
echo $value;

Using the "round" function works well though, but i need to use the 'floor' methods.

Thanks for your help.

Romz
  • 86
  • 1
  • 4

0 Answers0