3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getSundaysForTheMonth($y, $m) { return new DatePeriod( new DateTime("first sunday of $y-$m"), DateInterval::createFromDateString('next sunday'), new DateTime("last day of $y-$m 23:59:59") ); } // Get current Year and Month $currentYear = date('Y'); $currentMonth = date('m'); // Get month name $beginMonthName = date("F", mktime(0, 0, 0, $currentMonth, 10)); echo "Select which Sunday(s) of the month of ". $beginMonthName . " " . $currentYear . " :\n<BR>"; $i=0; // Display all Sundays for 3 months foreach (getSundaysForTheMonth($currentYear, $currentMonth) as $sunday) { $thisSunday = $sunday->format("m - d - Y"); echo "<input type=\"checkbox\" name=\"date[]\" value=\"$thisSunday\">$thisSunday\n<BR>"; $i++; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 44
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 44
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/BNabV
function name:  (null)
number of ops:  46
compiled vars:  !0 = $currentYear, !1 = $currentMonth, !2 = $beginMonthName, !3 = $i, !4 = $sunday, !5 = $thisSunday
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'Y'
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
   14     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'm'
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !1, $8
   17     8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'F'
         10        INIT_FCALL                                               'mktime'
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 0
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 10
         16        DO_ICALL                                         $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !2, $11
   20    20        CONCAT                                           ~13     'Select+which+Sunday%28s%29+of+the+month+of+', !2
         21        CONCAT                                           ~14     ~13, '+'
         22        CONCAT                                           ~15     ~14, !0
         23        CONCAT                                           ~16     ~15, '+%3A%0A%3CBR%3E'
         24        ECHO                                                     ~16
   21    25        ASSIGN                                                   !3, 0
   24    26        INIT_FCALL                                               'getsundaysforthemonth'
         27        SEND_VAR                                                 !0
         28        SEND_VAR                                                 !1
         29        DO_FCALL                                      0  $18     
         30      > FE_RESET_R                                       $19     $18, ->44
         31    > > FE_FETCH_R                                               $19, !4, ->44
   25    32    >   INIT_METHOD_CALL                                         !4, 'format'
         33        SEND_VAL_EX                                              'm+-+d+-+Y'
         34        DO_FCALL                                      0  $20     
         35        ASSIGN                                                   !5, $20
   26    36        ROPE_INIT                                     5  ~23     '%3Cinput+type%3D%22checkbox%22+name%3D%22date%5B%5D%22+value%3D%22'
         37        ROPE_ADD                                      1  ~23     ~23, !5
         38        ROPE_ADD                                      2  ~23     ~23, '%22%3E'
         39        ROPE_ADD                                      3  ~23     ~23, !5
         40        ROPE_END                                      4  ~22     ~23, '%0A%3CBR%3E'
         41        ECHO                                                     ~22
   27    42        PRE_INC                                                  !3
   24    43      > JMP                                                      ->31
         44    >   FE_FREE                                                  $19
   28    45      > RETURN                                                   1

Function getsundaysforthemonth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BNabV
function name:  getSundaysForTheMonth
number of ops:  27
compiled vars:  !0 = $y, !1 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        NEW                                              $2      'DatePeriod'
    6     3        NEW                                              $3      'DateTime'
          4        ROPE_INIT                                     4  ~5      'first+sunday+of+'
          5        ROPE_ADD                                      1  ~5      ~5, !0
          6        ROPE_ADD                                      2  ~5      ~5, '-'
          7        ROPE_END                                      3  ~4      ~5, !1
          8        SEND_VAL_EX                                              ~4
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $3
    7    11        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         12        SEND_VAL                                                 'next+sunday'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR_NO_REF_EX                                       $8
    8    15        NEW                                              $9      'DateTime'
         16        ROPE_INIT                                     5  ~11     'last+day+of+'
         17        ROPE_ADD                                      1  ~11     ~11, !0
         18        ROPE_ADD                                      2  ~11     ~11, '-'
         19        ROPE_ADD                                      3  ~11     ~11, !1
         20        ROPE_END                                      4  ~10     ~11, '+23%3A59%3A59'
         21        SEND_VAL_EX                                              ~10
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $9
    5    24        DO_FCALL                                      0          
    8    25      > RETURN                                                   $2
   10    26*     > RETURN                                                   null

End of function getsundaysforthemonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.07 ms | 1008 KiB | 16 Q