3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timePassed($time){ $time = time() - $time; echo $time; $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':''); } } echo timePassed('2014-04-03 19:21:30');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/39Cn3
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'timepassed'
          1        SEND_VAL                                                 '2014-04-03+19%3A21%3A30'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

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

End of function timepassed

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.25 ms | 1403 KiB | 18 Q