Rounding - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Rounding.php
- <?php
- $time_raw = '3:25:12';
- $time = str_replace('.', ':', $time_raw);
- $res = explode(":",$time);
- echo 'Minutes = ' . $res[0] . '<br>';
- echo 'Seconds = ' . $res[1] . '<br>';
- echo 'Seconds = ' . ceil($res[1] / 10) *10 . '<br>'; // go up
- echo 'Seconds = ' . $res[1] = 10 * floor($res[1] / 10) . '<br>'; // go up;
- echo 'Milliseconds = ' . $res[2] . '<br>';