3v4l.org

run code in 300+ PHP versions simultaneously
<?php $m = 1; $y = 2016; echo "Reference Calendar\n\n January 2016 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 \n\n"; echo "Original date Snaps to\n\n"; 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 str_pad(date('l',strtotime("$m/$day/$y")), 9, " ", STR_PAD_LEFT)," $m/$day/$y: ",date('r',$snap),"\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 61
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 61
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
filename:       /in/JD3AN
function name:  (null)
number of ops:  63
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
    5     2        ECHO                                                     'Reference+Calendar%0A%0A++++January+2016++++++%0ASu+Mo+Tu+We+Th+Fr+Sa++%0A++++++++++++++++1++2++%0A+3++4++5++6++7++8++9++%0A10+11+12+13+14+15+16++%0A17+18+19+20+21+22+23++%0A24+25+26+27+28+29+30++%0A31++++++++++++++++++%0A%0A'
   13     3        ECHO                                                     'Original+date++++++++Snaps+to%0A%0A'
   14     4        INIT_FCALL                                               'range'
          5        SEND_VAL                                                 1
          6        SEND_VAL                                                 31
          7        DO_ICALL                                         $6      
          8      > FE_RESET_R                                       $7      $6, ->61
          9    > > FE_FETCH_R                                               $7, !2, ->61
   15    10    >   IS_SMALLER_OR_EQUAL                                      !2, 9
         11      > JMPZ                                                     ~8, ->14
   16    12    >   CONCAT                                           ~9      '0', !2
         13        ASSIGN                                                   !2, ~9
   21    14    >   INIT_FCALL                                               'strtotime'
         15        SEND_VAL                                                 'monday+this+week'
         16        INIT_FCALL                                               'strtotime'
         17        ROPE_INIT                                     5  ~12     !0
         18        ROPE_ADD                                      1  ~12     ~12, '%2F'
         19        ROPE_ADD                                      2  ~12     ~12, !2
         20        ROPE_ADD                                      3  ~12     ~12, '%2F'
         21        ROPE_END                                      4  ~11     ~12, !1
         22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $15     
         24        SEND_VAR                                                 $15
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !3, $16
   24    27        INIT_FCALL                                               'str_pad'
         28        INIT_FCALL                                               'date'
         29        SEND_VAL                                                 'l'
         30        INIT_FCALL                                               'strtotime'
         31        ROPE_INIT                                     5  ~19     !0
         32        ROPE_ADD                                      1  ~19     ~19, '%2F'
         33        ROPE_ADD                                      2  ~19     ~19, !2
         34        ROPE_ADD                                      3  ~19     ~19, '%2F'
         35        ROPE_END                                      4  ~18     ~19, !1
         36        SEND_VAL                                                 ~18
         37        DO_ICALL                                         $22     
         38        SEND_VAR                                                 $22
         39        DO_ICALL                                         $23     
         40        SEND_VAR                                                 $23
         41        SEND_VAL                                                 9
         42        SEND_VAL                                                 '+'
         43        SEND_VAL                                                 0
         44        DO_ICALL                                         $24     
         45        ECHO                                                     $24
         46        ROPE_INIT                                     7  ~26     '+'
         47        ROPE_ADD                                      1  ~26     ~26, !0
         48        ROPE_ADD                                      2  ~26     ~26, '%2F'
         49        ROPE_ADD                                      3  ~26     ~26, !2
         50        ROPE_ADD                                      4  ~26     ~26, '%2F'
         51        ROPE_ADD                                      5  ~26     ~26, !1
         52        ROPE_END                                      6  ~25     ~26, '%3A+'
         53        ECHO                                                     ~25
         54        INIT_FCALL                                               'date'
         55        SEND_VAL                                                 'r'
         56        SEND_VAR                                                 !3
         57        DO_ICALL                                         $30     
         58        ECHO                                                     $30
         59        ECHO                                                     '%0A'
   14    60      > JMP                                                      ->9
         61    >   FE_FREE                                                  $7
   25    62      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.91 ms | 1400 KiB | 21 Q