1echo(floor(0.60) . "<br>"); // 0
2echo(floor(0.40) . "<br>"); // 0
3echo(floor(5) . "<br>"); // 5
4echo(floor(5.1) . "<br>"); //5
5echo(floor(-5.1) . "<br>"); // -6
6echo(floor(-5.9)); // -6
7
8echo(ceil(0.60) . "<br>"); // 1
9echo(ceil(0.40) . "<br>"); // 1
10echo(ceil(5) . "<br>"); // 5
11echo(ceil(5.1) . "<br>"); // 6
12echo(ceil(-5.1) . "<br>"); // -5
13echo(ceil(-5.9)); // -5
1
2<?php
3echo 'Rounding modes with 9.5' . PHP_EOL;
4var_dump(round(9.5, 0, PHP_ROUND_HALF_UP));
5var_dump(round(9.5, 0, PHP_ROUND_HALF_DOWN));
6var_dump(round(9.5, 0, PHP_ROUND_HALF_EVEN));
7var_dump(round(9.5, 0, PHP_ROUND_HALF_ODD));
8
9echo 'Rounding modes with 8.5' . PHP_EOL;
10var_dump(round(8.5, 0, PHP_ROUND_HALF_UP));
11var_dump(round(8.5, 0, PHP_ROUND_HALF_DOWN));
12var_dump(round(8.5, 0, PHP_ROUND_HALF_EVEN));
13var_dump(round(8.5, 0, PHP_ROUND_HALF_ODD));
14?>
15
16