3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($seconds) { $t = round($seconds); echo ($t/3600); if (($t/3600) > 0) return sprintf('%02d:%02d', ($t/60%60), $t%60); return sprintf('%02d:%02d:%02d', ($t/3600),($t/60%60), $t%60); } echo foo('290.52262423327'). "\n"; echo foo('9290.52262423327'). "\n"; echo foo(86400+120+6). "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3LaH6
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'foo'
          1        SEND_VAL                                                 '290.52262423327'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   13     5        INIT_FCALL                                               'foo'
          6        SEND_VAL                                                 '9290.52262423327'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   14    10        INIT_FCALL                                               'foo'
         11        SEND_VAL                                                 86526
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
         15      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3LaH6
function name:  foo
number of ops:  31
compiled vars:  !0 = $seconds, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'round'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
    5     5        DIV                                              ~4      !1, 3600
          6        ECHO                                                     ~4
    7     7        DIV                                              ~5      !1, 3600
          8        IS_SMALLER                                               0, ~5
          9      > JMPZ                                                     ~6, ->19
    8    10    >   INIT_FCALL                                               'sprintf'
         11        SEND_VAL                                                 '%2502d%3A%2502d'
         12        DIV                                              ~7      !1, 60
         13        MOD                                              ~8      ~7, 60
         14        SEND_VAL                                                 ~8
         15        MOD                                              ~9      !1, 60
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                         $10     
         18      > RETURN                                                   $10
    9    19    >   INIT_FCALL                                               'sprintf'
         20        SEND_VAL                                                 '%2502d%3A%2502d%3A%2502d'
         21        DIV                                              ~11     !1, 3600
         22        SEND_VAL                                                 ~11
         23        DIV                                              ~12     !1, 60
         24        MOD                                              ~13     ~12, 60
         25        SEND_VAL                                                 ~13
         26        MOD                                              ~14     !1, 60
         27        SEND_VAL                                                 ~14
         28        DO_ICALL                                         $15     
         29      > RETURN                                                   $15
   10    30*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.53 ms | 1403 KiB | 20 Q