3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getWednesdays($y, $m) { $ts = strtotime("first wednesday of $y-$m-01"); $end = strtotime("last wednesday of $y-$m"); $wednesdays = array(); while($ts <= $end) { $wednesdays[] = $ts; $ts = strtotime('next wednesday', $ts); } return $wednesdays; } foreach (getWednesdays(2014, 1) as $wednesday) { echo date("l, Y-m-d\n", $wednesday); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/YcfVX
function name:  (null)
number of ops:  14
compiled vars:  !0 = $wednesday
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'getwednesdays'
          1        SEND_VAL                                                 2014
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $1      
          4      > FE_RESET_R                                       $2      $1, ->12
          5    > > FE_FETCH_R                                               $2, !0, ->12
   15     6    >   INIT_FCALL                                               'date'
          7        SEND_VAL                                                 'l%2C+Y-m-d%0A'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        ECHO                                                     $3
   14    11      > JMP                                                      ->5
         12    >   FE_FREE                                                  $2
   16    13      > RETURN                                                   1

Function getwednesdays:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 21
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 21
Branch analysis from position: 30
Branch analysis from position: 21
filename:       /in/YcfVX
function name:  getWednesdays
number of ops:  32
compiled vars:  !0 = $y, !1 = $m, !2 = $ts, !3 = $end, !4 = $wednesdays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'strtotime'
          3        ROPE_INIT                                     5  ~6      'first+wednesday+of+'
          4        ROPE_ADD                                      1  ~6      ~6, !0
          5        ROPE_ADD                                      2  ~6      ~6, '-'
          6        ROPE_ADD                                      3  ~6      ~6, !1
          7        ROPE_END                                      4  ~5      ~6, '-01'
          8        SEND_VAL                                                 ~5
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !2, $9
    5    11        INIT_FCALL                                               'strtotime'
         12        ROPE_INIT                                     4  ~12     'last+wednesday+of+'
         13        ROPE_ADD                                      1  ~12     ~12, !0
         14        ROPE_ADD                                      2  ~12     ~12, '-'
         15        ROPE_END                                      3  ~11     ~12, !1
         16        SEND_VAL                                                 ~11
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !3, $14
    6    19        ASSIGN                                                   !4, <array>
    7    20      > JMP                                                      ->28
    8    21    >   ASSIGN_DIM                                               !4
         22        OP_DATA                                                  !2
    9    23        INIT_FCALL                                               'strtotime'
         24        SEND_VAL                                                 'next+wednesday'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !2, $18
    7    28    >   IS_SMALLER_OR_EQUAL                                      !2, !3
         29      > JMPNZ                                                    ~20, ->21
   11    30    > > RETURN                                                   !4
   12    31*     > RETURN                                                   null

End of function getwednesdays

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.98 ms | 1403 KiB | 18 Q