3v4l.org

run code in 300+ PHP versions simultaneously
<?php function drawMonth($month, $year, $jelentkezettNapok, $napiJelentkezokSzama) { // $months = Array("Január", "Február", "Március", "Április", "Május", "Június", "Július", // "Augusztus", "Szeptember", "Október", "November", "December"); //echo "<p class='honapNeve'>".$months[$month - 1]."</p>"; // echo "<table class='naptar'>"; // echo "<tr><th>H</th><th>K</th><th>Sz</th><th>Cs</th><th>P</th><th>Sz</th><th>V</th></tr>"; $firstDayOfTheMonth = mktime(0, 0, 0, $month, 1, $year); $d = getdate($firstDayOfTheMonth); // Vasarnap helyett hetfo az elso nap a heten. Pl. "6" jelentese: szombaton kezdodik a honap. $dayOfTheWeekOfFirstDayOfTheMonth = (6 + $d["wday"]) % 7 + 1; // Hany napos a honap. $totalDaysInCurrentMonth = date("t", $firstDayOfTheMonth); $kellenekUresNapokAHonapVegen = true; for ($i = 0; $i < $totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1); $i++) { // Csak az aktuális héttől kezdve. Megjegyzés: date("W") hétfőt tekinti a hét első napjának, ami nekünk pont megfelel. $day = $i - $dayOfTheWeekOfFirstDayOfTheMonth + 2; $dateWeek = date("W", mktime(0, 0, 0, $month, $day, $year)); /*if (intval(date("W", $firstDayOfTheMonth)) > intval($dateWeek)) { continue; }*/ // NEW NEW NEW NEW ======================= $thisMondayInt = intval(date('Ymd', strtotime('- ' . (intval(date('N')) - 1) . ' days'))); $dateInt = intval(date("Ymd", mktime(0, 0, 0, $month, $day, $year))); if ($thisMondayInt > $dateInt) { continue; } // NEW NEW NEW NEW ======================= // A hónap végén azokat a heteket nem jelenítjük meg, amikre még nem lehetne jelentkezni. $utolsoJelentkezhetoNap = strtotime("+ 28 day"); $utolsoJelentkezhetoHet = intval(date("W", strtotime("+ 28 day"))); /*if ($utolsoJelentkezhetoHet < intval(date("W"))) { // Ez decemberben fordulhat elo, amikor is 28 nap mulva mar januarra esik. Ebben az esetben // az egesz honapot ki kell irni. $utolsoJelentkezhetoHet += 52; } TODO */ // date("W", mktime(0, 0, 0, 12, 31, 2012)) hibasan 1-et ad 53 helyett, ezert a december // honapot kulon kell kezelni. /*if (!($month == 12 && $day >= 3) && intval($dateWeek) > $utolsoJelentkezhetoHet) { $kellenekUresNapokAHonapVegen = false; continue; }*/ // NEW NEW NEW NEW ======================= $SundayOfFourWeeksLaterInt = intval(date('Ymd', strtotime('+ ' . (28 + 7 - intval(date('N', strtotime('+ 28 days')))) . ' days'))); if ($dateInt > $SundayOfFourWeeksLaterInt) { $kellenekUresNapokAHonapVegen = false; continue; } // NEW NEW NEW NEW ======================= if ($i % 7 == 0) { echo "<tr>"; } if ($i < $dayOfTheWeekOfFirstDayOfTheMonth - 1) { // Ures napok a honap elejen. echo "<td class='noborder'></td>"; } else if ($i < $totalDaysInCurrentMonth + $dayOfTheWeekOfFirstDayOfTheMonth - 1){ // Naptari napok. $day = $i - $dayOfTheWeekOfFirstDayOfTheMonth + 2; $date = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); $napiJelentkezok = isset($napiJelentkezokSzama[$date]) ? $napiJelentkezokSzama[$date] : 0; // .... echo $day . "nap "; } else { // TODO(palinko): Kell ez? echo "<td class='noborder'></td>"; } if ($i % 7 == 6) { echo "</tr>"; } } // Üres napok a hónap végén. Csak akkor, ha nem üres hetet (7 üres napot) kellene kiírni. // TODO(palinko): $kellenekUresNapokAHonapVegen-t helyesen számolni eredetileg is. if ($kellenekUresNapokAHonapVegen && ($totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1)) % 7 > 0) { for ($i = ($totalDaysInCurrentMonth + ($dayOfTheWeekOfFirstDayOfTheMonth - 1)) % 7; $i < 7; $i++) { echo "<td class='noborder'></td>"; } } // echo "</table>"; } drawMonth(1, 2013, array(), array()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MSYLN
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   INIT_FCALL                                               'drawmonth'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 2013
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0          
   83     6      > RETURN                                                   1

Function drawmonth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 161
Branch analysis from position: 161
2 jumps found. (Code = 44) Position 1 = 165, Position 2 = 30
Branch analysis from position: 165
2 jumps found. (Code = 46) Position 1 = 166, Position 2 = 171
Branch analysis from position: 166
2 jumps found. (Code = 43) Position 1 = 172, Position 2 = 181
Branch analysis from position: 172
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 177
Branch analysis from position: 181
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 177
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 177
Branch analysis from position: 181
Branch analysis from position: 177
Branch analysis from position: 181
Branch analysis from position: 171
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 79
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 160
Branch analysis from position: 160
2 jumps found. (Code = 44) Position 1 = 165, Position 2 = 30
Branch analysis from position: 165
Branch analysis from position: 30
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 116
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 160
Branch analysis from position: 160
Branch analysis from position: 116
2 jumps found. (Code = 43) Position 1 = 119, Position 2 = 120
Branch analysis from position: 119
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 125
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 156
Branch analysis from position: 156
2 jumps found. (Code = 43) Position 1 = 159, Position 2 = 160
Branch analysis from position: 159
2 jumps found. (Code = 44) Position 1 = 165, Position 2 = 30
Branch analysis from position: 165
Branch analysis from position: 30
Branch analysis from position: 160
Branch analysis from position: 125
2 jumps found. (Code = 43) Position 1 = 129, Position 2 = 155
Branch analysis from position: 129
2 jumps found. (Code = 43) Position 1 = 147, Position 2 = 150
Branch analysis from position: 147
1 jumps found. (Code = 42) Position 1 = 151
Branch analysis from position: 151
1 jumps found. (Code = 42) Position 1 = 156
Branch analysis from position: 156
Branch analysis from position: 150
1 jumps found. (Code = 42) Position 1 = 156
Branch analysis from position: 156
Branch analysis from position: 155
2 jumps found. (Code = 43) Position 1 = 159, Position 2 = 160
Branch analysis from position: 159
Branch analysis from position: 160
Branch analysis from position: 120
filename:       /in/MSYLN
function name:  drawMonth
number of ops:  182
compiled vars:  !0 = $month, !1 = $year, !2 = $jelentkezettNapok, !3 = $napiJelentkezokSzama, !4 = $firstDayOfTheMonth, !5 = $d, !6 = $dayOfTheWeekOfFirstDayOfTheMonth, !7 = $totalDaysInCurrentMonth, !8 = $kellenekUresNapokAHonapVegen, !9 = $i, !10 = $day, !11 = $dateWeek, !12 = $thisMondayInt, !13 = $dateInt, !14 = $utolsoJelentkezhetoNap, !15 = $utolsoJelentkezhetoHet, !16 = $SundayOfFourWeeksLaterInt, !17 = $date, !18 = $napiJelentkezok
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    9     4        INIT_FCALL                                               'mktime'
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 0
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 1
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $19     
         12        ASSIGN                                                   !4, $19
   10    13        INIT_FCALL                                               'getdate'
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $21     
         16        ASSIGN                                                   !5, $21
   12    17        FETCH_DIM_R                                      ~23     !5, 'wday'
         18        ADD                                              ~24     6, ~23
         19        MOD                                              ~25     ~24, 7
         20        ADD                                              ~26     ~25, 1
         21        ASSIGN                                                   !6, ~26
   14    22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 't'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $28     
         26        ASSIGN                                                   !7, $28
   15    27        ASSIGN                                                   !8, <true>
   16    28        ASSIGN                                                   !9, 0
         29      > JMP                                                      ->161
   18    30    >   SUB                                              ~32     !9, !6
         31        ADD                                              ~33     ~32, 2
         32        ASSIGN                                                   !10, ~33
   19    33        INIT_FCALL                                               'date'
         34        SEND_VAL                                                 'W'
         35        INIT_FCALL                                               'mktime'
         36        SEND_VAL                                                 0
         37        SEND_VAL                                                 0
         38        SEND_VAL                                                 0
         39        SEND_VAR                                                 !0
         40        SEND_VAR                                                 !10
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                         $35     
         43        SEND_VAR                                                 $35
         44        DO_ICALL                                         $36     
         45        ASSIGN                                                   !11, $36
   25    46        INIT_FCALL                                               'date'
         47        SEND_VAL                                                 'Ymd'
         48        INIT_FCALL                                               'strtotime'
         49        INIT_FCALL                                               'date'
         50        SEND_VAL                                                 'N'
         51        DO_ICALL                                         $38     
         52        CAST                                          4  ~39     $38
         53        SUB                                              ~40     ~39, 1
         54        CONCAT                                           ~41     '-+', ~40
         55        CONCAT                                           ~42     ~41, '+days'
         56        SEND_VAL                                                 ~42
         57        DO_ICALL                                         $43     
         58        SEND_VAR                                                 $43
         59        DO_ICALL                                         $44     
         60        CAST                                          4  ~45     $44
         61        ASSIGN                                                   !12, ~45
   26    62        INIT_FCALL                                               'date'
         63        SEND_VAL                                                 'Ymd'
         64        INIT_FCALL                                               'mktime'
         65        SEND_VAL                                                 0
         66        SEND_VAL                                                 0
         67        SEND_VAL                                                 0
         68        SEND_VAR                                                 !0
         69        SEND_VAR                                                 !10
         70        SEND_VAR                                                 !1
         71        DO_ICALL                                         $47     
         72        SEND_VAR                                                 $47
         73        DO_ICALL                                         $48     
         74        CAST                                          4  ~49     $48
         75        ASSIGN                                                   !13, ~49
   27    76        IS_SMALLER                                               !13, !12
         77      > JMPZ                                                     ~51, ->79
   28    78    > > JMP                                                      ->160
   32    79    >   INIT_FCALL                                               'strtotime'
         80        SEND_VAL                                                 '%2B+28+day'
         81        DO_ICALL                                         $52     
         82        ASSIGN                                                   !14, $52
   33    83        INIT_FCALL                                               'date'
         84        SEND_VAL                                                 'W'
         85        INIT_FCALL                                               'strtotime'
         86        SEND_VAL                                                 '%2B+28+day'
         87        DO_ICALL                                         $54     
         88        SEND_VAR                                                 $54
         89        DO_ICALL                                         $55     
         90        CAST                                          4  ~56     $55
         91        ASSIGN                                                   !15, ~56
   46    92        INIT_FCALL                                               'date'
         93        SEND_VAL                                                 'Ymd'
         94        INIT_FCALL                                               'strtotime'
         95        INIT_FCALL                                               'date'
         96        SEND_VAL                                                 'N'
         97        INIT_FCALL                                               'strtotime'
         98        SEND_VAL                                                 '%2B+28+days'
         99        DO_ICALL                                         $58     
        100        SEND_VAR                                                 $58
        101        DO_ICALL                                         $59     
        102        CAST                                          4  ~60     $59
        103        SUB                                              ~61     35, ~60
        104        CONCAT                                           ~62     '%2B+', ~61
        105        CONCAT                                           ~63     ~62, '+days'
        106        SEND_VAL                                                 ~63
        107        DO_ICALL                                         $64     
        108        SEND_VAR                                                 $64
        109        DO_ICALL                                         $65     
        110        CAST                                          4  ~66     $65
        111        ASSIGN                                                   !16, ~66
   47   112        IS_SMALLER                                               !16, !13
        113      > JMPZ                                                     ~68, ->116
   48   114    >   ASSIGN                                                   !8, <false>
   49   115      > JMP                                                      ->160
   52   116    >   MOD                                              ~70     !9, 7
        117        IS_EQUAL                                                 ~70, 0
        118      > JMPZ                                                     ~71, ->120
   53   119    >   ECHO                                                     '%3Ctr%3E'
   55   120    >   SUB                                              ~72     !6, 1
        121        IS_SMALLER                                               !9, ~72
        122      > JMPZ                                                     ~73, ->125
   57   123    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
        124      > JMP                                                      ->156
   58   125    >   ADD                                              ~74     !7, !6
        126        SUB                                              ~75     ~74, 1
        127        IS_SMALLER                                               !9, ~75
        128      > JMPZ                                                     ~76, ->155
   60   129    >   SUB                                              ~77     !9, !6
        130        ADD                                              ~78     ~77, 2
        131        ASSIGN                                                   !10, ~78
   61   132        INIT_FCALL                                               'date'
        133        SEND_VAL                                                 'Y-m-d'
        134        INIT_FCALL                                               'mktime'
        135        SEND_VAL                                                 0
        136        SEND_VAL                                                 0
        137        SEND_VAL                                                 0
        138        SEND_VAR                                                 !0
        139        SEND_VAR                                                 !10
        140        SEND_VAR                                                 !1
        141        DO_ICALL                                         $80     
        142        SEND_VAR                                                 $80
        143        DO_ICALL                                         $81     
        144        ASSIGN                                                   !17, $81
   62   145        ISSET_ISEMPTY_DIM_OBJ                         0          !3, !17
        146      > JMPZ                                                     ~83, ->150
        147    >   FETCH_DIM_R                                      ~84     !3, !17
        148        QM_ASSIGN                                        ~85     ~84
        149      > JMP                                                      ->151
        150    >   QM_ASSIGN                                        ~85     0
        151    >   ASSIGN                                                   !18, ~85
   64   152        CONCAT                                           ~87     !10, 'nap+'
        153        ECHO                                                     ~87
        154      > JMP                                                      ->156
   67   155    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   69   156    >   MOD                                              ~88     !9, 7
        157        IS_EQUAL                                                 ~88, 6
        158      > JMPZ                                                     ~89, ->160
   70   159    >   ECHO                                                     '%3C%2Ftr%3E'
   16   160    >   PRE_INC                                                  !9
        161    >   SUB                                              ~91     !6, 1
        162        ADD                                              ~92     !7, ~91
        163        IS_SMALLER                                               !9, ~92
        164      > JMPNZ                                                    ~93, ->30
   75   165    > > JMPZ_EX                                          ~94     !8, ->171
        166    >   SUB                                              ~95     !6, 1
        167        ADD                                              ~96     !7, ~95
        168        MOD                                              ~97     ~96, 7
        169        IS_SMALLER                                       ~98     0, ~97
        170        BOOL                                             ~94     ~98
        171    > > JMPZ                                                     ~94, ->181
   76   172    >   SUB                                              ~99     !6, 1
        173        ADD                                              ~100    !7, ~99
        174        MOD                                              ~101    ~100, 7
        175        ASSIGN                                                   !9, ~101
        176      > JMP                                                      ->179
   77   177    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   76   178        PRE_INC                                                  !9
        179    >   IS_SMALLER                                               !9, 7
        180      > JMPNZ                                                    ~104, ->177
   81   181    > > RETURN                                                   null

End of function drawmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.2 ms | 1415 KiB | 22 Q