3v4l.org

run code in 300+ PHP versions simultaneously
<?php { $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); $lengths = array("60","60","24","7","4.35","12","10"); $now = time(); $difference = $now - $time; $tense = "ago"; for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); if($difference != 1) { $periods[$j].= "s"; } return "$difference $periods[$j] $tense"; } echo timeago($diff); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
Branch analysis from position: 20
Branch analysis from position: 20
filename:       /in/QWCbN
function name:  (null)
number of ops:  41
compiled vars:  !0 = $periods, !1 = $lengths, !2 = $now, !3 = $difference, !4 = $time, !5 = $tense, !6 = $j, !7 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'time'
          3        DO_ICALL                                         $10     
          4        ASSIGN                                                   !2, $10
    9     5        SUB                                              ~12     !2, !4
          6        ASSIGN                                                   !3, ~12
   10     7        ASSIGN                                                   !5, 'ago'
   12     8        ASSIGN                                                   !6, 0
          9      > JMP                                                      ->13
   14    10    >   FETCH_DIM_R                                      ~16     !1, !6
         11        ASSIGN_OP                                     4          !3, ~16
   12    12        PRE_INC                                                  !6
         13    >   FETCH_DIM_R                                      ~19     !1, !6
         14        IS_SMALLER_OR_EQUAL                              ~20     ~19, !3
         15      > JMPZ_EX                                          ~20     ~20, ->20
         16    >   COUNT                                            ~21     !1
         17        SUB                                              ~22     ~21, 1
         18        IS_SMALLER                                       ~23     !6, ~22
         19        BOOL                                             ~20     ~23
         20    > > JMPNZ                                                    ~20, ->10
   17    21    >   INIT_FCALL                                               'round'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $24     
         24        ASSIGN                                                   !3, $24
   19    25        IS_NOT_EQUAL                                             !3, 1
         26      > JMPZ                                                     ~26, ->29
   21    27    >   ASSIGN_DIM_OP                .=               8          !0, !6
         28        OP_DATA                                                  's'
   24    29    >   ROPE_INIT                                     5  ~30     !3
         30        ROPE_ADD                                      1  ~30     ~30, '+'
         31        FETCH_DIM_R                                      ~28     !0, !6
         32        ROPE_ADD                                      2  ~30     ~30, ~28
         33        ROPE_ADD                                      3  ~30     ~30, '+'
         34        ROPE_END                                      4  ~29     ~30, !5
         35      > RETURN                                                   ~29
   27    36*       INIT_FCALL_BY_NAME                                       'timeago'
         37*       SEND_VAR_EX                                              !7
         38*       DO_FCALL                                      0  $33     
         39*       ECHO                                                     $33
         40*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.8 ms | 1400 KiB | 17 Q