3v4l.org

run code in 300+ PHP versions simultaneously
<?php $quarters = array(15, 30, 45, 60); $diff = 15; foreach($quarters as $quarter){ $curMinutes = date('i'); $curMinutes = (strlen($curMinutes) == 2) ? (int) $curMinutes[1] : (int) $curMinutes; $curDiff = $quarter - date('i'); if($curDiff < $diff && $curDiff > 0){ $diff = $curDiff; } } $dt = new DateTime; $dt->add(new DateInterval('PT'.$diff.'M')); echo $dt->format('Y-m-d H:i:00');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 30
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 30
Branch analysis from position: 4
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 = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 29
Branch analysis from position: 27
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
Branch analysis from position: 27
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/ElHgI
function name:  (null)
number of ops:  47
compiled vars:  !0 = $quarters, !1 = $diff, !2 = $quarter, !3 = $curMinutes, !4 = $curDiff, !5 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 15
    5     2      > FE_RESET_R                                       $8      !0, ->30
          3    > > FE_FETCH_R                                               $8, !2, ->30
    6     4    >   INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'i'
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !3, $9
    7     8        STRLEN                                           ~11     !3
          9        IS_EQUAL                                                 ~11, 2
         10      > JMPZ                                                     ~12, ->15
         11    >   FETCH_DIM_R                                      ~13     !3, 1
         12        CAST                                          4  ~14     ~13
         13        QM_ASSIGN                                        ~15     ~14
         14      > JMP                                                      ->17
         15    >   CAST                                          4  ~16     !3
         16        QM_ASSIGN                                        ~15     ~16
         17    >   ASSIGN                                                   !3, ~15
    8    18        INIT_FCALL                                               'date'
         19        SEND_VAL                                                 'i'
         20        DO_ICALL                                         $18     
         21        SUB                                              ~19     !2, $18
         22        ASSIGN                                                   !4, ~19
    9    23        IS_SMALLER                                       ~21     !4, !1
         24      > JMPZ_EX                                          ~21     ~21, ->27
         25    >   IS_SMALLER                                       ~22     0, !4
         26        BOOL                                             ~21     ~22
         27    > > JMPZ                                                     ~21, ->29
   10    28    >   ASSIGN                                                   !1, !4
    5    29    > > JMP                                                      ->3
         30    >   FE_FREE                                                  $8
   14    31        NEW                                              $24     'DateTime'
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !5, $24
   15    34        INIT_METHOD_CALL                                         !5, 'add'
         35        NEW                                              $27     'DateInterval'
         36        CONCAT                                           ~28     'PT', !1
         37        CONCAT                                           ~29     ~28, 'M'
         38        SEND_VAL_EX                                              ~29
         39        DO_FCALL                                      0          
         40        SEND_VAR_NO_REF_EX                                       $27
         41        DO_FCALL                                      0          
   16    42        INIT_METHOD_CALL                                         !5, 'format'
         43        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3A00'
         44        DO_FCALL                                      0  $32     
         45        ECHO                                                     $32
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.31 ms | 1400 KiB | 15 Q