3v4l.org

run code in 300+ PHP versions simultaneously
<?php $m = 1; $y = 2016; foreach (range(1, 31) as $day) { if($day <= 9){ $day = '0'.$day; } // this is the important bit $snap = strtotime("monday this week",strtotime("$m/$day/$y")); echo 'Snapping ',str_pad(date('l',strtotime("$m/$day/$y")), 9, " ", STR_PAD_LEFT)," $m/$day/$y results: ",date('r',$snap),"\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 60
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 60
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
filename:       /in/WbQWr
function name:  (null)
number of ops:  62
compiled vars:  !0 = $m, !1 = $y, !2 = $day, !3 = $snap
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 1
    4     1        ASSIGN                                                   !1, 2016
    6     2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 31
          5        DO_ICALL                                         $6      
          6      > FE_RESET_R                                       $7      $6, ->60
          7    > > FE_FETCH_R                                               $7, !2, ->60
    7     8    >   IS_SMALLER_OR_EQUAL                                      !2, 9
          9      > JMPZ                                                     ~8, ->12
    8    10    >   CONCAT                                           ~9      '0', !2
         11        ASSIGN                                                   !2, ~9
   12    12    >   INIT_FCALL                                               'strtotime'
         13        SEND_VAL                                                 'monday+this+week'
         14        INIT_FCALL                                               'strtotime'
         15        ROPE_INIT                                     5  ~12     !0
         16        ROPE_ADD                                      1  ~12     ~12, '%2F'
         17        ROPE_ADD                                      2  ~12     ~12, !2
         18        ROPE_ADD                                      3  ~12     ~12, '%2F'
         19        ROPE_END                                      4  ~11     ~12, !1
         20        SEND_VAL                                                 ~11
         21        DO_ICALL                                         $15     
         22        SEND_VAR                                                 $15
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !3, $16
   14    25        ECHO                                                     'Snapping+'
         26        INIT_FCALL                                               'str_pad'
         27        INIT_FCALL                                               'date'
         28        SEND_VAL                                                 'l'
         29        INIT_FCALL                                               'strtotime'
         30        ROPE_INIT                                     5  ~19     !0
         31        ROPE_ADD                                      1  ~19     ~19, '%2F'
         32        ROPE_ADD                                      2  ~19     ~19, !2
         33        ROPE_ADD                                      3  ~19     ~19, '%2F'
         34        ROPE_END                                      4  ~18     ~19, !1
         35        SEND_VAL                                                 ~18
         36        DO_ICALL                                         $22     
         37        SEND_VAR                                                 $22
         38        DO_ICALL                                         $23     
         39        SEND_VAR                                                 $23
         40        SEND_VAL                                                 9
         41        SEND_VAL                                                 '+'
         42        SEND_VAL                                                 0
         43        DO_ICALL                                         $24     
         44        ECHO                                                     $24
         45        ROPE_INIT                                     7  ~26     '+'
         46        ROPE_ADD                                      1  ~26     ~26, !0
         47        ROPE_ADD                                      2  ~26     ~26, '%2F'
         48        ROPE_ADD                                      3  ~26     ~26, !2
         49        ROPE_ADD                                      4  ~26     ~26, '%2F'
         50        ROPE_ADD                                      5  ~26     ~26, !1
         51        ROPE_END                                      6  ~25     ~26, '+results%3A+'
         52        ECHO                                                     ~25
         53        INIT_FCALL                                               'date'
         54        SEND_VAL                                                 'r'
         55        SEND_VAR                                                 !3
         56        DO_ICALL                                         $30     
         57        ECHO                                                     $30
         58        ECHO                                                     '%0A'
    6    59      > JMP                                                      ->7
         60    >   FE_FREE                                                  $7
   15    61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.6 ms | 1400 KiB | 21 Q