3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = strtotime('2010-04-28 17:25:43'); echo 'event happened '.humanTiming($time).' ago'; if (true) { function humanTiming ($time) { $time = time() - $time; // to get the time since that moment $tokens = array ( 31536000 => 'year', 2592000 => 'month', 604800 => 'week', 86400 => 'day', 3600 => 'hour', 60 => 'minute', 1 => 'second'); foreach ($tokens as $unit => $text) { if ($time < $unit) continue; $numberOfUnits = floor($time / $unit); return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':''); } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/rRXvq
function name:  (null)
number of ops:  13
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '2010-04-28+17%3A25%3A43'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
    5     4        INIT_FCALL_BY_NAME                                       'humanTiming'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $3      
          7        CONCAT                                           ~4      'event+happened+', $3
          8        CONCAT                                           ~5      ~4, '+ago'
          9        ECHO                                                     ~5
    7    10      > JMPZ                                                     <true>, ->12
    8    11    >   DECLARE_FUNCTION                                         'humantiming'
   27    12    > > RETURN                                                   1

Function %00humantiming%2Fin%2FrRXvq%3A8%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 28
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 28
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/rRXvq
function name:  humanTiming
number of ops:  30
compiled vars:  !0 = $time, !1 = $tokens, !2 = $text, !3 = $unit, !4 = $numberOfUnits
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'time'
          2        DO_ICALL                                         $5      
          3        SUB                                              ~6      $5, !0
          4        ASSIGN                                                   !0, ~6
   12     5        ASSIGN                                                   !1, <array>
   21     6      > FE_RESET_R                                       $9      !1, ->28
          7    > > FE_FETCH_R                                       ~10     $9, !2, ->28
          8    >   ASSIGN                                                   !3, ~10
   22     9        IS_SMALLER                                               !0, !3
         10      > JMPZ                                                     ~12, ->12
         11    > > JMP                                                      ->7
   23    12    >   INIT_FCALL                                               'floor'
         13        DIV                                              ~13     !0, !3
         14        SEND_VAL                                                 ~13
         15        DO_ICALL                                         $14     
         16        ASSIGN                                                   !4, $14
   24    17        CONCAT                                           ~16     !4, '+'
         18        CONCAT                                           ~17     ~16, !2
         19        IS_SMALLER                                               1, !4
         20      > JMPZ                                                     ~18, ->23
         21    >   QM_ASSIGN                                        ~19     's'
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~19     ''
         24    >   CONCAT                                           ~20     ~17, ~19
         25        FE_FREE                                                  $9
         26      > RETURN                                                   ~20
   21    27*       JMP                                                      ->7
         28    >   FE_FREE                                                  $9
   26    29      > RETURN                                                   null

End of function %00humantiming%2Fin%2FrRXvq%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.21 ms | 1400 KiB | 19 Q