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.



Your result can be seen below.

Result of php executing





Full code of Rounding.php

  1. <?php
  2.  
  3. $time_raw = '3:25:12';
  4.  
  5. $time = str_replace('.', ':', $time_raw);
  6.  
  7. $res = explode(":",$time);
  8.  
  9. echo 'Minutes = ' . $res[0] . '<br>';
  10. echo 'Seconds = ' . $res[1] . '<br>';
  11. echo 'Seconds = ' . ceil($res[1] / 10) *10 . '<br>'; // go up
  12. echo 'Seconds = ' . $res[1] = 10 * floor($res[1] / 10) . '<br>'; // go up;
  13. echo 'Milliseconds = ' . $res[2] . '<br>';
File Description
  • Rounding
  • PHP Code
  • 30 Aug-2019
  • 361 Bytes
You can Share it: