fork(1) download
  1. <?php
  2.  
  3. function floorLikeInExcel($number, $significance) {
  4. return $number - fmod($number, $significance);
  5. }
  6.  
  7. echo floorLikeInExcel(3.7, 2) . PHP_EOL;
  8. echo floorLikeInExcel(-2.5, -2) . PHP_EOL;
  9. echo floorLikeInExcel(2.5, -2) . PHP_EOL;
  10. echo floorLikeInExcel(1.58, 0.1) . PHP_EOL;
  11. echo floorLikeInExcel(0.234, 0.01) . PHP_EOL;
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
2
-2
2
1.5
0.23