3v4l.org

run code in 300+ PHP versions simultaneously
<?php $days = []; $searchData = ['dat' => '2015-11-11']; $offset = 3; $now = date_create(); $offsetStart = -1 * $offset; echo date_create($searchData['dat'])->modify($offsetStart .' days')->format('Y-m-d H:i'); echo PHP_EOL . $now->format('Y-m-d H:i:s'); echo PHP_EOL . date_create($searchData['dat'])->diff($now)->format('%a'); if (date_create($searchData['dat'])->modify($offsetStart .' days') < $now) { $offsetStart = -1 * date_create($searchData['dat'])->diff($now)->format('%a'); } $offsetEnd = 2 * $offset + $offsetStart; for ($i = $offsetStart; $i <= $offsetEnd; $i++) { $days[] = $i; } print_r($days);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 59
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 64
Branch analysis from position: 69
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 64
Branch analysis from position: 69
Branch analysis from position: 64
Branch analysis from position: 59
filename:       /in/n9Ysi
function name:  (null)
number of ops:  73
compiled vars:  !0 = $days, !1 = $searchData, !2 = $offset, !3 = $now, !4 = $offsetStart, !5 = $offsetEnd, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 3
    6     3        INIT_FCALL                                               'date_create'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !3, $10
    8     6        MUL                                              ~12     !2, -1
          7        ASSIGN                                                   !4, ~12
    9     8        INIT_FCALL                                               'date_create'
          9        FETCH_DIM_R                                      ~14     !1, 'dat'
         10        SEND_VAL                                                 ~14
         11        DO_ICALL                                         $15     
         12        INIT_METHOD_CALL                                         $15, 'modify'
         13        CONCAT                                           ~16     !4, '+days'
         14        SEND_VAL_EX                                              ~16
         15        DO_FCALL                                      0  $17     
         16        INIT_METHOD_CALL                                         $17, 'format'
         17        SEND_VAL_EX                                              'Y-m-d+H%3Ai'
         18        DO_FCALL                                      0  $18     
         19        ECHO                                                     $18
   10    20        INIT_METHOD_CALL                                         !3, 'format'
         21        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
         22        DO_FCALL                                      0  $19     
         23        CONCAT                                           ~20     '%0A', $19
         24        ECHO                                                     ~20
   11    25        INIT_FCALL                                               'date_create'
         26        FETCH_DIM_R                                      ~21     !1, 'dat'
         27        SEND_VAL                                                 ~21
         28        DO_ICALL                                         $22     
         29        INIT_METHOD_CALL                                         $22, 'diff'
         30        SEND_VAR_EX                                              !3
         31        DO_FCALL                                      0  $23     
         32        INIT_METHOD_CALL                                         $23, 'format'
         33        SEND_VAL_EX                                              '%25a'
         34        DO_FCALL                                      0  $24     
         35        CONCAT                                           ~25     '%0A', $24
         36        ECHO                                                     ~25
   12    37        INIT_FCALL                                               'date_create'
         38        FETCH_DIM_R                                      ~26     !1, 'dat'
         39        SEND_VAL                                                 ~26
         40        DO_ICALL                                         $27     
         41        INIT_METHOD_CALL                                         $27, 'modify'
         42        CONCAT                                           ~28     !4, '+days'
         43        SEND_VAL_EX                                              ~28
         44        DO_FCALL                                      0  $29     
         45        IS_SMALLER                                               $29, !3
         46      > JMPZ                                                     ~30, ->59
   13    47    >   INIT_FCALL                                               'date_create'
         48        FETCH_DIM_R                                      ~31     !1, 'dat'
         49        SEND_VAL                                                 ~31
         50        DO_ICALL                                         $32     
         51        INIT_METHOD_CALL                                         $32, 'diff'
         52        SEND_VAR_EX                                              !3
         53        DO_FCALL                                      0  $33     
         54        INIT_METHOD_CALL                                         $33, 'format'
         55        SEND_VAL_EX                                              '%25a'
         56        DO_FCALL                                      0  $34     
         57        MUL                                              ~35     $34, -1
         58        ASSIGN                                                   !4, ~35
   15    59    >   MUL                                              ~37     !2, 2
         60        ADD                                              ~38     ~37, !4
         61        ASSIGN                                                   !5, ~38
   17    62        ASSIGN                                                   !6, !4
         63      > JMP                                                      ->67
   18    64    >   ASSIGN_DIM                                               !0
         65        OP_DATA                                                  !6
   17    66        PRE_INC                                                  !6
         67    >   IS_SMALLER_OR_EQUAL                                      !6, !5
         68      > JMPNZ                                                    ~43, ->64
   21    69    >   INIT_FCALL                                               'print_r'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.53 ms | 1400 KiB | 17 Q