1// round down
2echo floor(1.5); // prints 1
3
4// round up
5echo ceil(1.5); // prints 2
1$int = 8.998988776636;
2round($int) //Will always be 9
3
4$int = 8.344473773737377474;
5round($int) //will always be 8
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