3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($seconds) { $t = round($seconds); echo round($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/mr4OQ
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 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mr4OQ
function name:  foo
number of ops:  34
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        INIT_FCALL                                               'round'
          6        DIV                                              ~4      !1, 3600
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        ECHO                                                     $5
    7    10        DIV                                              ~6      !1, 3600
         11        IS_SMALLER                                               0, ~6
         12      > JMPZ                                                     ~7, ->22
    8    13    >   INIT_FCALL                                               'sprintf'
         14        SEND_VAL                                                 '%2502d%3A%2502d'
         15        DIV                                              ~8      !1, 60
         16        MOD                                              ~9      ~8, 60
         17        SEND_VAL                                                 ~9
         18        MOD                                              ~10     !1, 60
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                         $11     
         21      > RETURN                                                   $11
    9    22    >   INIT_FCALL                                               'sprintf'
         23        SEND_VAL                                                 '%2502d%3A%2502d%3A%2502d'
         24        DIV                                              ~12     !1, 3600
         25        SEND_VAL                                                 ~12
         26        DIV                                              ~13     !1, 60
         27        MOD                                              ~14     ~13, 60
         28        SEND_VAL                                                 ~14
         29        MOD                                              ~15     !1, 60
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                         $16     
         32      > RETURN                                                   $16
   10    33*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.27 ms | 1403 KiB | 20 Q