3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRoundedCutoff () { $time = explode(':', $this->cutoff_time); if ( $time[2] > 30 ) $time[1] = intval($time[1]) + 1; $time[2] = '00'; $rmin = $time[1] % 15; $dt = new DateTime( implode(':', $time) ); if ( $rmin > 7 ) { $dt->add(new DateInterval('PT'.(15-$rmin).'M')); } else { $dt->sub(new DateInterval('PT'.$rmin.'M')); } return $dt->format('H:i:s'); } $times = array( '10:52:00', '10:52:59', '10:53:00', '10:50:00', '10:50:14', '10:50:59', '10:50:45', '01:12:00', '01:05:00', '01:58:00', '01:58:59', '01:01:00', ); foreach ($times as $time) { var_dump($time.' -> '.getRoundedCutoff($time)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/LL1MD
function name:  (null)
number of ops:  14
compiled vars:  !0 = $times, !1 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   35     1      > FE_RESET_R                                       $3      !0, ->12
          2    > > FE_FETCH_R                                               $3, !1, ->12
   36     3    >   INIT_FCALL                                               'var_dump'
          4        CONCAT                                           ~4      !1, '+-%3E+'
          5        INIT_FCALL                                               'getroundedcutoff'
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      ~4, $5
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
   35    11      > JMP                                                      ->2
         12    >   FE_FREE                                                  $3
   37    13      > RETURN                                                   1

Function getroundedcutoff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 40
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/LL1MD
function name:  getRoundedCutoff
number of ops:  53
compiled vars:  !0 = $time, !1 = $rmin, !2 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '%3A'
          2        FETCH_THIS                                       $3      
          3        FETCH_OBJ_R                                      ~4      $3, 'cutoff_time'
          4        SEND_VAL                                                 ~4
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !0, $5
    5     7        FETCH_DIM_R                                      ~7      !0, 2
          8        IS_SMALLER                                               30, ~7
          9      > JMPZ                                                     ~8, ->15
         10    >   FETCH_DIM_R                                      ~10     !0, 1
         11        CAST                                          4  ~11     ~10
         12        ADD                                              ~12     ~11, 1
         13        ASSIGN_DIM                                               !0, 1
         14        OP_DATA                                                  ~12
    6    15    >   ASSIGN_DIM                                               !0, 2
         16        OP_DATA                                                  '00'
    8    17        FETCH_DIM_R                                      ~14     !0, 1
         18        MOD                                              ~15     ~14, 15
         19        ASSIGN                                                   !1, ~15
    9    20        NEW                                              $17     'DateTime'
         21        INIT_FCALL                                               'implode'
         22        SEND_VAL                                                 '%3A'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $18     
         25        SEND_VAR_NO_REF_EX                                       $18
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !2, $17
   11    28        IS_SMALLER                                               7, !1
         29      > JMPZ                                                     ~21, ->40
   12    30    >   INIT_METHOD_CALL                                         !2, 'add'
         31        NEW                                              $22     'DateInterval'
         32        SUB                                              ~23     15, !1
         33        CONCAT                                           ~24     'PT', ~23
         34        CONCAT                                           ~25     ~24, 'M'
         35        SEND_VAL_EX                                              ~25
         36        DO_FCALL                                      0          
         37        SEND_VAR_NO_REF_EX                                       $22
         38        DO_FCALL                                      0          
         39      > JMP                                                      ->48
   14    40    >   INIT_METHOD_CALL                                         !2, 'sub'
         41        NEW                                              $28     'DateInterval'
         42        CONCAT                                           ~29     'PT', !1
         43        CONCAT                                           ~30     ~29, 'M'
         44        SEND_VAL_EX                                              ~30
         45        DO_FCALL                                      0          
         46        SEND_VAR_NO_REF_EX                                       $28
         47        DO_FCALL                                      0          
   17    48    >   INIT_METHOD_CALL                                         !2, 'format'
         49        SEND_VAL_EX                                              'H%3Ai%3As'
         50        DO_FCALL                                      0  $33     
         51      > RETURN                                                   $33
   18    52*     > RETURN                                                   null

End of function getroundedcutoff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.8 ms | 1403 KiB | 20 Q