3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fillStart = strtotime("2019-07-23 00:15:00"); $fillEnd = strtotime("2019-09-23 13:00:00"); $gapStart = strtotime("2019-05-23 00:15:00"); $gapEnd = strtotime("2019-06-23 13:00:00"); // $wdtStart = date("l H:i:s", $gapStart); if (date("l H:i:s", $fillStart) == $wdtStart) { // already good $fillStartModified = $fillStart; } else { // move forward $fillStartModified = strtotime("next {$wdtStart}", $fillStart); } $wdtEnd = date("l H:i:s", $gapEnd); if (date("l H:i:s", $fillEnd) == $wdtEnd) { // already good $fillEndModified = $fillEnd; } else { // move backward $fillEndModified = strtotime("last {$wdtEnd}", $fillEnd); } printf("Start %s adjusted for %s = %s\n", date("l Y-m-d H:i:s", $fillStart), $wdtStart, date("l Y-m-d H:i:s", $fillStartModified)); printf("End %s adjusted for %s = %s\n", date("l Y-m-d H:i:s", $fillEnd), $wdtEnd, date("l Y-m-d H:i:s", $fillEndModified));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
Branch analysis from position: 49
filename:       /in/0lBR6
function name:  (null)
number of ops:  85
compiled vars:  !0 = $fillStart, !1 = $fillEnd, !2 = $gapStart, !3 = $gapEnd, !4 = $wdtStart, !5 = $fillStartModified, !6 = $wdtEnd, !7 = $fillEndModified
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '2019-07-23+00%3A15%3A00'
          2        DO_ICALL                                         $8      
          3        ASSIGN                                                   !0, $8
    4     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 '2019-09-23+13%3A00%3A00'
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !1, $10
    5     8        INIT_FCALL                                               'strtotime'
          9        SEND_VAL                                                 '2019-05-23+00%3A15%3A00'
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !2, $12
    6    12        INIT_FCALL                                               'strtotime'
         13        SEND_VAL                                                 '2019-06-23+13%3A00%3A00'
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !3, $14
   10    16        INIT_FCALL                                               'date'
         17        SEND_VAL                                                 'l+H%3Ai%3As'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $16     
         20        ASSIGN                                                   !4, $16
   11    21        INIT_FCALL                                               'date'
         22        SEND_VAL                                                 'l+H%3Ai%3As'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $18     
         25        IS_EQUAL                                                 !4, $18
         26      > JMPZ                                                     ~19, ->29
   13    27    >   ASSIGN                                                   !5, !0
         28      > JMP                                                      ->36
   16    29    >   INIT_FCALL                                               'strtotime'
         30        NOP                                                      
         31        FAST_CONCAT                                      ~21     'next+', !4
         32        SEND_VAL                                                 ~21
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $22     
         35        ASSIGN                                                   !5, $22
   19    36    >   INIT_FCALL                                               'date'
         37        SEND_VAL                                                 'l+H%3Ai%3As'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                         $24     
         40        ASSIGN                                                   !6, $24
   20    41        INIT_FCALL                                               'date'
         42        SEND_VAL                                                 'l+H%3Ai%3As'
         43        SEND_VAR                                                 !1
         44        DO_ICALL                                         $26     
         45        IS_EQUAL                                                 !6, $26
         46      > JMPZ                                                     ~27, ->49
   22    47    >   ASSIGN                                                   !7, !1
         48      > JMP                                                      ->56
   25    49    >   INIT_FCALL                                               'strtotime'
         50        NOP                                                      
         51        FAST_CONCAT                                      ~29     'last+', !6
         52        SEND_VAL                                                 ~29
         53        SEND_VAR                                                 !1
         54        DO_ICALL                                         $30     
         55        ASSIGN                                                   !7, $30
   28    56    >   INIT_FCALL                                               'printf'
         57        SEND_VAL                                                 'Start+%25s+adjusted+for+%25s+%3D+%25s%0A'
         58        INIT_FCALL                                               'date'
         59        SEND_VAL                                                 'l+Y-m-d+H%3Ai%3As'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $32     
         62        SEND_VAR                                                 $32
         63        SEND_VAR                                                 !4
         64        INIT_FCALL                                               'date'
         65        SEND_VAL                                                 'l+Y-m-d+H%3Ai%3As'
         66        SEND_VAR                                                 !5
         67        DO_ICALL                                         $33     
         68        SEND_VAR                                                 $33
         69        DO_ICALL                                                 
   29    70        INIT_FCALL                                               'printf'
         71        SEND_VAL                                                 'End+++%25s+adjusted+for+%25s+%3D+%25s%0A'
         72        INIT_FCALL                                               'date'
         73        SEND_VAL                                                 'l+Y-m-d+H%3Ai%3As'
         74        SEND_VAR                                                 !1
         75        DO_ICALL                                         $35     
         76        SEND_VAR                                                 $35
         77        SEND_VAR                                                 !6
         78        INIT_FCALL                                               'date'
         79        SEND_VAL                                                 'l+Y-m-d+H%3Ai%3As'
         80        SEND_VAR                                                 !7
         81        DO_ICALL                                         $36     
         82        SEND_VAR                                                 $36
         83        DO_ICALL                                                 
         84      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.34 ms | 1409 KiB | 19 Q