3v4l.org

run code in 300+ PHP versions simultaneously
<?php // vychozi pripocet je cela ctvrthodina $diff = 15; $dt = new DateTime; $minutes = $dt->format('i'); $minutes = (strlen($minutes) == 1) ? (int) $minutes[1] : (int) $minutes; // najdi nejblizsi celou ctvrthodinu $quarters = array(15, 30, 45, 60); foreach($quarters as $quarter){ $curDiff = $quarter - $minutes; echo $curDiff."\n"; // pokud je interval mensi nez minuly a zaroven kladny // presne 0 je na dane ctvrthodine a to chceme pripocist plnych 15 min if($curDiff < $diff && $curDiff > 0){ $diff = $curDiff; } } $dt->add(new DateInterval('PT'.$diff.'M')); echo $dt->format('Y-m-d H:i:00').PHP_EOL; echo date('H:i');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 32
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 32
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 31
Branch analysis from position: 29
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 32
Branch analysis from position: 20
Branch analysis from position: 32
filename:       /in/ce0TC
function name:  (null)
number of ops:  51
compiled vars:  !0 = $diff, !1 = $dt, !2 = $minutes, !3 = $quarters, !4 = $quarter, !5 = $curDiff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 15
    6     1        NEW                                              $7      'DateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
    8     4        INIT_METHOD_CALL                                         !1, 'format'
          5        SEND_VAL_EX                                              'i'
          6        DO_FCALL                                      0  $10     
          7        ASSIGN                                                   !2, $10
    9     8        STRLEN                                           ~12     !2
          9        IS_EQUAL                                                 ~12, 1
         10      > JMPZ                                                     ~13, ->15
         11    >   FETCH_DIM_R                                      ~14     !2, 1
         12        CAST                                          4  ~15     ~14
         13        QM_ASSIGN                                        ~16     ~15
         14      > JMP                                                      ->17
         15    >   CAST                                          4  ~17     !2
         16        QM_ASSIGN                                        ~16     ~17
         17    >   ASSIGN                                                   !2, ~16
   12    18        ASSIGN                                                   !3, <array>
   13    19      > FE_RESET_R                                       $20     !3, ->32
         20    > > FE_FETCH_R                                               $20, !4, ->32
   14    21    >   SUB                                              ~21     !4, !2
         22        ASSIGN                                                   !5, ~21
   16    23        CONCAT                                           ~23     !5, '%0A'
         24        ECHO                                                     ~23
   20    25        IS_SMALLER                                       ~24     !5, !0
         26      > JMPZ_EX                                          ~24     ~24, ->29
         27    >   IS_SMALLER                                       ~25     0, !5
         28        BOOL                                             ~24     ~25
         29    > > JMPZ                                                     ~24, ->31
   21    30    >   ASSIGN                                                   !0, !5
   13    31    > > JMP                                                      ->20
         32    >   FE_FREE                                                  $20
   25    33        INIT_METHOD_CALL                                         !1, 'add'
         34        NEW                                              $27     'DateInterval'
         35        CONCAT                                           ~28     'PT', !0
         36        CONCAT                                           ~29     ~28, 'M'
         37        SEND_VAL_EX                                              ~29
         38        DO_FCALL                                      0          
         39        SEND_VAR_NO_REF_EX                                       $27
         40        DO_FCALL                                      0          
   27    41        INIT_METHOD_CALL                                         !1, 'format'
         42        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3A00'
         43        DO_FCALL                                      0  $32     
         44        CONCAT                                           ~33     $32, '%0A'
         45        ECHO                                                     ~33
   28    46        INIT_FCALL                                               'date'
         47        SEND_VAL                                                 'H%3Ai'
         48        DO_ICALL                                         $34     
         49        ECHO                                                     $34
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.71 ms | 1392 KiB | 15 Q