3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime('first Monday of this month'); echo $dt->format('W'); $month = "3"; $year = "2014"; $beg = (int) date('W', strtotime("first monday of $year-$month")); $end = (int) date('W', strtotime("last monday of $year-$month")); print(join(', ', range($beg, $end)));
based on 9qnsh
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/JtFU0
function name:  (null)
number of ops:  46
compiled vars:  !0 = $dt, !1 = $month, !2 = $year, !3 = $beg, !4 = $end
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NEW                                              $5      :-6
         1        SEND_VAL_EX                                              'first+Monday+of+this+month'
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $5
   4     4        INIT_METHOD_CALL                                         !0, 'format'
         5        SEND_VAL_EX                                              'W'
         6        DO_FCALL                                      0  $8      
         7        ECHO                                                     $8
   5     8        ASSIGN                                                   !1, '3'
   6     9        ASSIGN                                                   !2, '2014'
   8    10        INIT_FCALL                                               'date'
        11        SEND_VAL                                                 'W'
        12        INIT_FCALL                                               'strtotime'
        13        ROPE_INIT                                     4  ~12     'first+monday+of+'
        14        ROPE_ADD                                      1  ~12     ~12, !2
        15        ROPE_ADD                                      2  ~12     ~12, '-'
        16        ROPE_END                                      3  ~11     ~12, !1
        17        SEND_VAL                                                 ~11
        18        DO_ICALL                                         $14     
        19        SEND_VAR                                                 $14
        20        DO_ICALL                                         $15     
        21        CAST                                          4  ~16     $15
        22        ASSIGN                                                   !3, ~16
   9    23        INIT_FCALL                                               'date'
        24        SEND_VAL                                                 'W'
        25        INIT_FCALL                                               'strtotime'
        26        ROPE_INIT                                     4  ~19     'last++monday+of+'
        27        ROPE_ADD                                      1  ~19     ~19, !2
        28        ROPE_ADD                                      2  ~19     ~19, '-'
        29        ROPE_END                                      3  ~18     ~19, !1
        30        SEND_VAL                                                 ~18
        31        DO_ICALL                                         $21     
        32        SEND_VAR                                                 $21
        33        DO_ICALL                                         $22     
        34        CAST                                          4  ~23     $22
        35        ASSIGN                                                   !4, ~23
  11    36        INIT_FCALL                                               'join'
        37        SEND_VAL                                                 '%2C+'
        38        INIT_FCALL                                               'range'
        39        SEND_VAR                                                 !3
        40        SEND_VAR                                                 !4
        41        DO_ICALL                                         $25     
        42        SEND_VAR                                                 $25
        43        DO_ICALL                                         $26     
        44        ECHO                                                     $26
        45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0