3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatTimeInterval($diffTime, $formatted = true) { /** * $diffTime = $diffTime / 1000; // miliseconds2seconds() */ $day = 60 * 60 * 24; $hour = 60 * 60; $minute = 60; $days = floor($diffTime / $day); $hours = floor(($diffTime % $day) / $hour); $minutes = floor(($diffTime % $hour) / $minute); $timeStr = ''; if ($formatted) { if ($days) { $timeStr .= '<b>' . $days . '</b> д'; } if ($hours) { $timeStr .= ' <b>' . $hours . '</b> ч'; } if ($minutes) { $timeStr .= ' <b>' . $minutes . '</b> м'; } return trim($timeStr); } return [ 'days' => $days, 'hours' => $hours, 'minutes' => $minutes, ]; } function isDefective() { $created = strtotime('2013-08-01 12:03:56'); $now = strtotime('2013-08-01 12:13:14'); $t = formatTimeInterval($now - $created, false); return ($t['minutes'] > 15); } var_dump(isDefective());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8BbMN
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'isdefective'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

Function formattimeinterval:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 40
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 32
Branch analysis from position: 28
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8BbMN
function name:  formatTimeInterval
number of ops:  45
compiled vars:  !0 = $diffTime, !1 = $formatted, !2 = $day, !3 = $hour, !4 = $minute, !5 = $days, !6 = $hours, !7 = $minutes, !8 = $timeStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
    7     2        ASSIGN                                                   !2, 86400
    8     3        ASSIGN                                                   !3, 3600
    9     4        ASSIGN                                                   !4, 60
   10     5        INIT_FCALL                                               'floor'
          6        DIV                                              ~12     !0, !2
          7        SEND_VAL                                                 ~12
          8        DO_ICALL                                         $13     
          9        ASSIGN                                                   !5, $13
   11    10        INIT_FCALL                                               'floor'
         11        MOD                                              ~15     !0, !2
         12        DIV                                              ~16     ~15, !3
         13        SEND_VAL                                                 ~16
         14        DO_ICALL                                         $17     
         15        ASSIGN                                                   !6, $17
   12    16        INIT_FCALL                                               'floor'
         17        MOD                                              ~19     !0, !3
         18        DIV                                              ~20     ~19, !4
         19        SEND_VAL                                                 ~20
         20        DO_ICALL                                         $21     
         21        ASSIGN                                                   !7, $21
   13    22        ASSIGN                                                   !8, ''
   14    23      > JMPZ                                                     !1, ->40
   15    24    > > JMPZ                                                     !5, ->28
   16    25    >   CONCAT                                           ~24     '%3Cb%3E', !5
         26        CONCAT                                           ~25     ~24, '%3C%2Fb%3E+%D0%B4'
         27        ASSIGN_OP                                     8          !8, ~25
   18    28    > > JMPZ                                                     !6, ->32
   19    29    >   CONCAT                                           ~27     '+%3Cb%3E', !6
         30        CONCAT                                           ~28     ~27, '%3C%2Fb%3E+%D1%87'
         31        ASSIGN_OP                                     8          !8, ~28
   21    32    > > JMPZ                                                     !7, ->36
   22    33    >   CONCAT                                           ~30     '+%3Cb%3E', !7
         34        CONCAT                                           ~31     ~30, '%3C%2Fb%3E+%D0%BC'
         35        ASSIGN_OP                                     8          !8, ~31
   24    36    >   INIT_FCALL                                               'trim'
         37        SEND_VAR                                                 !8
         38        DO_ICALL                                         $33     
         39      > RETURN                                                   $33
   27    40    >   INIT_ARRAY                                       ~34     !5, 'days'
   28    41        ADD_ARRAY_ELEMENT                                ~34     !6, 'hours'
   29    42        ADD_ARRAY_ELEMENT                                ~34     !7, 'minutes'
         43      > RETURN                                                   ~34
   31    44*     > RETURN                                                   null

End of function formattimeinterval

Function isdefective:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8BbMN
function name:  isDefective
number of ops:  18
compiled vars:  !0 = $created, !1 = $now, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '2013-08-01+12%3A03%3A56'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
   36     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 '2013-08-01+12%3A13%3A14'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   37     8        INIT_FCALL                                               'formattimeinterval'
          9        SUB                                              ~7      !1, !0
         10        SEND_VAL                                                 ~7
         11        SEND_VAL                                                 <false>
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !2, $8
   38    14        FETCH_DIM_R                                      ~10     !2, 'minutes'
         15        IS_SMALLER                                       ~11     15, ~10
         16      > RETURN                                                   ~11
   39    17*     > RETURN                                                   null

End of function isdefective

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.74 ms | 1403 KiB | 23 Q