Gavin PHP - 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 Gavin PHP.php

  1. <?php
  2.  
  3. $test = array('10.21', '59.56', '1:01.33', '3:43.12', '2:12:33');
  4.  
  5.  
  6. foreach($test as $row) {
  7.     $one = sprintf("%08s", $row);
  8.     $two = str_replace('000', '00:', $one);
  9.     echo $one . '<br>';
  10.     echo $two . '<br>';
  11.     echo ltrim($row, ':0') . '<br><br>';
  12. }
  13.  
  14. $testTime = '2:12:56';
  15.  
  16. //echo sprintf("%08.10s", $testTime);
  17.  
  18. //echo $time = sprintf("%08s", $testTime) . '<br>'; 
  19. //echo str_replace('000', '00:', $time);
  20.  
  21.  
File Description
  • Gavin PHP
  • PHP Code
  • 16 Sep-2019
  • 428 Bytes
You can Share it: