3v4l.org

run code in 300+ PHP versions simultaneously
<?php function time_format($time) { $a = array( 12 * 30 * 24 * 60 * 60 => 'year', 30 * 24 * 60 * 60 => 'month', 24 * 60 * 60 => 'day', 60 * 60 => 'hour', 60 => 'minute', 1 => 'second' ); foreach ($a as $secs => $str) { $d = $time / $secs; if ($d >= 1) { $r = round($d); return $r . ' ' . $str . ($r > 1 ? 's' : ''); } } return 0; } echo time_format(59013);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DB0Du
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'time_format'
          1        SEND_VAL                                                 59013
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function time_format:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/DB0Du
function name:  time_format
number of ops:  27
compiled vars:  !0 = $time, !1 = $a, !2 = $str, !3 = $secs, !4 = $d, !5 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <array>
   14     2      > FE_RESET_R                                       $7      !1, ->24
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->24
          4    >   ASSIGN                                                   !3, ~8
   16     5        DIV                                              ~10     !0, !3
          6        ASSIGN                                                   !4, ~10
   17     7        IS_SMALLER_OR_EQUAL                                      1, !4
          8      > JMPZ                                                     ~12, ->23
   19     9    >   INIT_FCALL                                               'round'
         10        SEND_VAR                                                 !4
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !5, $13
   20    13        CONCAT                                           ~15     !5, '+'
         14        CONCAT                                           ~16     ~15, !2
         15        IS_SMALLER                                               1, !5
         16      > JMPZ                                                     ~17, ->19
         17    >   QM_ASSIGN                                        ~18     's'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~18     ''
         20    >   CONCAT                                           ~19     ~16, ~18
         21        FE_FREE                                                  $7
         22      > RETURN                                                   ~19
   14    23    > > JMP                                                      ->3
         24    >   FE_FREE                                                  $7
   24    25      > RETURN                                                   0
   25    26*     > RETURN                                                   null

End of function time_format

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.79 ms | 1403 KiB | 16 Q