3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $yearMonth = '2017-06'; $firstDayOfThisMonth = new \DateTime($yearMonth . '-01'); var_dump($firstDayOfThisMonth->format('W')); $lastDayOfThisMonth = clone $firstDayOfThisMonth; $lastDayOfThisMonth = $lastDayOfThisMonth->modify('last day of this month'); var_dump($lastDayOfThisMonth->format('W')); $startDate = new \DateTime($firstDayOfThisMonth->format('Y') . 'W' . $firstDayOfThisMonth->format('W')); $endDate = new \DateTime($lastDayOfThisMonth->format('Y') . 'W' . $lastDayOfThisMonth->format('W')); $endDate->modify('+6 days'); var_dump($startDate); var_dump($endDate);
based on m5qdF
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/9FnN5
function name:  (null)
number of ops:  58
compiled vars:  !0 = $yearMonth, !1 = $firstDayOfThisMonth, !2 = $lastDayOfThisMonth, !3 = $startDate, !4 = $endDate
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, '2017-06'
   5     1        NEW                                              $6      :-4
         2        CONCAT                                           ~7      !0, '-01'
         3        SEND_VAL_EX                                              ~7
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !1, $6
   7     6        INIT_FCALL                                               'var_dump'
         7        INIT_METHOD_CALL                                         !1, 'format'
         8        SEND_VAL_EX                                              'W'
         9        DO_FCALL                                      0  $10     
        10        SEND_VAR                                                 $10
        11        DO_ICALL                                                 
   9    12        CLONE                                            ~12     !1
        13        ASSIGN                                                   !2, ~12
  10    14        INIT_METHOD_CALL                                         !2, 'modify'
        15        SEND_VAL_EX                                              'last+day+of+this+month'
        16        DO_FCALL                                      0  $14     
        17        ASSIGN                                                   !2, $14
  12    18        INIT_FCALL                                               'var_dump'
        19        INIT_METHOD_CALL                                         !2, 'format'
        20        SEND_VAL_EX                                              'W'
        21        DO_FCALL                                      0  $16     
        22        SEND_VAR                                                 $16
        23        DO_ICALL                                                 
  15    24        NEW                                              $18     :10
        25        INIT_METHOD_CALL                                         !1, 'format'
        26        SEND_VAL_EX                                              'Y'
        27        DO_FCALL                                      0  $19     
        28        CONCAT                                           ~20     $19, 'W'
        29        INIT_METHOD_CALL                                         !1, 'format'
        30        SEND_VAL_EX                                              'W'
        31        DO_FCALL                                      0  $21     
        32        CONCAT                                           ~22     ~20, $21
        33        SEND_VAL_EX                                              ~22
        34        DO_FCALL                                      0          
        35        ASSIGN                                                   !3, $18
  16    36        NEW                                              $25     :19
        37        INIT_METHOD_CALL                                         !2, 'format'
        38        SEND_VAL_EX                                              'Y'
        39        DO_FCALL                                      0  $26     
        40        CONCAT                                           ~27     $26, 'W'
        41        INIT_METHOD_CALL                                         !2, 'format'
        42        SEND_VAL_EX                                              'W'
        43        DO_FCALL                                      0  $28     
        44        CONCAT                                           ~29     ~27, $28
        45        SEND_VAL_EX                                              ~29
        46        DO_FCALL                                      0          
        47        ASSIGN                                                   !4, $25
  17    48        INIT_METHOD_CALL                                         !4, 'modify'
        49        SEND_VAL_EX                                              '%2B6+days'
        50        DO_FCALL                                      0          
  19    51        INIT_FCALL                                               'var_dump'
        52        SEND_VAR                                                 !3
        53        DO_ICALL                                                 
  20    54        INIT_FCALL                                               'var_dump'
        55        SEND_VAR                                                 !4
        56        DO_ICALL                                                 
        57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0