3v4l.org

run code in 300+ PHP versions simultaneously
<?php // http://stackoverflow.com/questions/13128854/php-datetime-class-change-first-day-of-the-week-to-monday?rq=1 $test = new DateTime('2012-11-04'); // 2012-11-05 // I expect to get 2012-10-29 echo $test->modify('Monday this week')->format('Y-m-d');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KdKdb
function name:  (null)
number of ops:  12
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $1      'DateTime'
          1        SEND_VAL_EX                                              '2012-11-04'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    8     4        INIT_METHOD_CALL                                         !0, 'modify'
          5        SEND_VAL_EX                                              'Monday+this+week'
          6        DO_FCALL                                      0  $4      
          7        INIT_METHOD_CALL                                         $4, 'format'
          8        SEND_VAL_EX                                              'Y-m-d'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155 ms | 1397 KiB | 13 Q