3v4l.org

run code in 300+ PHP versions simultaneously
<?php function oldFormatSeconds($ss) { $result = ''; $s = $ss % 60; $m = floor(($ss % 3600) / 60); $h = floor(($ss % 86400) / 3600); $d = floor(($ss % 2592000) / 86400); if ($d > 0) { $result .= $d . 'd, '; } if ($h > 0) { $result .= $h . 'h '; } if ($m > 0 || $s > 0) { $result .= $m . 'm '; } if ($s > 0) { $result .= $s . 's '; } return $result; } function formatSeconds($s) { return gmdate("H i s\s", 1000); } echo oldFormatSeconds(1000); echo "\n"; echo formatSeconds(1000);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uhS91
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   INIT_FCALL                                               'oldformatseconds'
          1        SEND_VAL                                                 1000
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   37     4        ECHO                                                     '%0A'
   38     5        INIT_FCALL                                               'formatseconds'
          6        SEND_VAL                                                 1000
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9      > RETURN                                                   1

Function oldformatseconds:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 47) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 37
Branch analysis from position: 34
Branch analysis from position: 30
Branch analysis from position: 26
filename:       /in/uhS91
function name:  oldFormatSeconds
number of ops:  43
compiled vars:  !0 = $ss, !1 = $result, !2 = $s, !3 = $m, !4 = $h, !5 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    7     2        MOD                                              ~7      !0, 60
          3        ASSIGN                                                   !2, ~7
    8     4        INIT_FCALL                                               'floor'
          5        MOD                                              ~9      !0, 3600
          6        DIV                                              ~10     ~9, 60
          7        SEND_VAL                                                 ~10
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !3, $11
    9    10        INIT_FCALL                                               'floor'
         11        MOD                                              ~13     !0, 86400
         12        DIV                                              ~14     ~13, 3600
         13        SEND_VAL                                                 ~14
         14        DO_ICALL                                         $15     
         15        ASSIGN                                                   !4, $15
   10    16        INIT_FCALL                                               'floor'
         17        MOD                                              ~17     !0, 2592000
         18        DIV                                              ~18     ~17, 86400
         19        SEND_VAL                                                 ~18
         20        DO_ICALL                                         $19     
         21        ASSIGN                                                   !5, $19
   12    22        IS_SMALLER                                               0, !5
         23      > JMPZ                                                     ~21, ->26
   13    24    >   CONCAT                                           ~22     !5, 'd%2C+'
         25        ASSIGN_OP                                     8          !1, ~22
   16    26    >   IS_SMALLER                                               0, !4
         27      > JMPZ                                                     ~24, ->30
   17    28    >   CONCAT                                           ~25     !4, 'h+'
         29        ASSIGN_OP                                     8          !1, ~25
   20    30    >   IS_SMALLER                                       ~27     0, !3
         31      > JMPNZ_EX                                         ~27     ~27, ->34
         32    >   IS_SMALLER                                       ~28     0, !2
         33        BOOL                                             ~27     ~28
         34    > > JMPZ                                                     ~27, ->37
   21    35    >   CONCAT                                           ~29     !3, 'm+'
         36        ASSIGN_OP                                     8          !1, ~29
   24    37    >   IS_SMALLER                                               0, !2
         38      > JMPZ                                                     ~31, ->41
   25    39    >   CONCAT                                           ~32     !2, 's+'
         40        ASSIGN_OP                                     8          !1, ~32
   28    41    > > RETURN                                                   !1
   29    42*     > RETURN                                                   null

End of function oldformatseconds

Function formatseconds:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uhS91
function name:  formatSeconds
number of ops:  7
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        INIT_FCALL                                               'gmdate'
          2        SEND_VAL                                                 'H+i+s%5Cs'
          3        SEND_VAL                                                 1000
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
   34     6*     > RETURN                                                   null

End of function formatseconds

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
316.91 ms | 1407 KiB | 20 Q