3v4l.org

run code in 300+ PHP versions simultaneously
<?php $day = 'saturday';$step = 2;$unit = 'W';$start = new DateTime();$end = clone $start;$start->modify($day); // Move to first occurence$end->add(new DateInterval('P1Y')); // Move to 1 year from start$interval = new DateInterval("P{$step}{$unit}");$period = new DatePeriod($start, $interval, $end);foreach ($period as $date) { echo $date->format('D, d M Y'), PHP_EOL;}
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZA4Go
function name:  (null)
number of ops:  12
compiled vars:  !0 = $day, !1 = $step, !2 = $unit, !3 = $start, !4 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ASSIGN                                                   !0, 'saturday'
          1        ASSIGN                                                   !1, 2
          2        ASSIGN                                                   !2, 'W'
          3        NEW                                              $8      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !3, $8
          6        CLONE                                            ~11     !3
          7        ASSIGN                                                   !4, ~11
          8        INIT_METHOD_CALL                                         !3, 'modify'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.41 ms | 1393 KiB | 13 Q