3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timePassed($time){ $time = time() - $time; echo $time."\n"; $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('139768782');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZPerp
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                                                 '139768782'
          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 = 9, Position 2 = 30
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/ZPerp
function name:  timePassed
number of ops:  32
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        CONCAT                                           ~8      !0, '%0A'
          6        ECHO                                                     ~8
    5     7        ASSIGN                                                   !1, <array>
   15     8      > FE_RESET_R                                       $10     !1, ->30
          9    > > FE_FETCH_R                                       ~11     $10, !2, ->30
         10    >   ASSIGN                                                   !3, ~11
   16    11        IS_SMALLER                                               !0, !3
         12      > JMPZ                                                     ~13, ->14
         13    > > JMP                                                      ->9
   17    14    >   INIT_FCALL                                               'floor'
         15        DIV                                              ~14     !0, !3
         16        SEND_VAL                                                 ~14
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !4, $15
   18    19        CONCAT                                           ~17     !4, '+'
         20        CONCAT                                           ~18     ~17, !2
         21        IS_SMALLER                                               1, !4
         22      > JMPZ                                                     ~19, ->25
         23    >   QM_ASSIGN                                        ~20     's'
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~20     ''
         26    >   CONCAT                                           ~21     ~18, ~20
         27        FE_FREE                                                  $10
         28      > RETURN                                                   ~21
   15    29*       JMP                                                      ->9
         30    >   FE_FREE                                                  $10
   20    31      > RETURN                                                   null

End of function timepassed

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.03 ms | 1402 KiB | 18 Q