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; } // A hónap végén azokat a heteket nem jelenítjük meg, amikre még nem lehetne jelentkezni. $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; } // 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; } 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; if (isset($jelentkezettNapok[$date])) { if (isDayInTheFuture($date)) { echo "<td title='Klikkelj a lemondáshoz' id='nap-".$date."' class='registered' onclick='lemondasMegerositese(\"".$date."\")'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>"; } else { if (isToday($date)) { echo "<td id='nap-".$date."' class='todayRegistered today'><span class='today'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>"; } else { echo "<td id='nap-".$date."' class='pastRegistered'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>"; } } } else { if (isToday($date)) { echo "<td id='nap-".$date."' class='notAvailableForRegistration today'><span class='today'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>"; } else { echo "<td title='Klikkelj a jelentkezéshez' id='nap-".$date."' " .(isDayAvailableForRegistration($date, $jelentkezettNapok) ? "class='availableForRegistration' onclick='jelentkezesMegerositese(\"".$date."\")'><span class='notToday'>".$day."</span>".getNapiJelentkezokHtml($napiJelentkezok)."</td>" : "class='notAvailableForRegistration'><span class='notToday'>".$day."</span></td>"); } } } 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/GN6KY
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   84     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          
   87     6      > RETURN                                                   1

Function drawmonth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 209
Branch analysis from position: 209
2 jumps found. (Code = 44) Position 1 = 213, Position 2 = 30
Branch analysis from position: 213
2 jumps found. (Code = 46) Position 1 = 214, Position 2 = 219
Branch analysis from position: 214
2 jumps found. (Code = 43) Position 1 = 220, Position 2 = 229
Branch analysis from position: 220
1 jumps found. (Code = 42) Position 1 = 227
Branch analysis from position: 227
2 jumps found. (Code = 44) Position 1 = 229, Position 2 = 225
Branch analysis from position: 229
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 225
2 jumps found. (Code = 44) Position 1 = 229, Position 2 = 225
Branch analysis from position: 229
Branch analysis from position: 225
Branch analysis from position: 229
Branch analysis from position: 219
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 55
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 208
Branch analysis from position: 208
2 jumps found. (Code = 44) Position 1 = 213, Position 2 = 30
Branch analysis from position: 213
Branch analysis from position: 30
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 71
Branch analysis from position: 70
2 jumps found. (Code = 46) Position 1 = 73, Position 2 = 75
Branch analysis from position: 73
2 jumps found. (Code = 46) Position 1 = 77, Position 2 = 80
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 83
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 208
Branch analysis from position: 208
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 87
Branch analysis from position: 86
2 jumps found. (Code = 43) Position 1 = 90, Position 2 = 92
Branch analysis from position: 90
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
2 jumps found. (Code = 43) Position 1 = 207, Position 2 = 208
Branch analysis from position: 207
2 jumps found. (Code = 44) Position 1 = 213, Position 2 = 30
Branch analysis from position: 213
Branch analysis from position: 30
Branch analysis from position: 208
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 96, Position 2 = 203
Branch analysis from position: 96
2 jumps found. (Code = 43) Position 1 = 114, Position 2 = 117
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 118
Branch analysis from position: 118
2 jumps found. (Code = 43) Position 1 = 121, Position 2 = 164
Branch analysis from position: 121
2 jumps found. (Code = 43) Position 1 = 125, Position 2 = 138
Branch analysis from position: 125
1 jumps found. (Code = 42) Position 1 = 163
Branch analysis from position: 163
1 jumps found. (Code = 42) Position 1 = 202
Branch analysis from position: 202
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
Branch analysis from position: 138
2 jumps found. (Code = 43) Position 1 = 142, Position 2 = 153
Branch analysis from position: 142
1 jumps found. (Code = 42) Position 1 = 163
Branch analysis from position: 163
Branch analysis from position: 153
1 jumps found. (Code = 42) Position 1 = 202
Branch analysis from position: 202
Branch analysis from position: 164
2 jumps found. (Code = 43) Position 1 = 168, Position 2 = 179
Branch analysis from position: 168
1 jumps found. (Code = 42) Position 1 = 202
Branch analysis from position: 202
Branch analysis from position: 179
2 jumps found. (Code = 43) Position 1 = 186, Position 2 = 197
Branch analysis from position: 186
1 jumps found. (Code = 42) Position 1 = 200
Branch analysis from position: 200
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
Branch analysis from position: 197
1 jumps found. (Code = 42) Position 1 = 204
Branch analysis from position: 204
Branch analysis from position: 117
2 jumps found. (Code = 43) Position 1 = 121, Position 2 = 164
Branch analysis from position: 121
Branch analysis from position: 164
Branch analysis from position: 203
2 jumps found. (Code = 43) Position 1 = 207, Position 2 = 208
Branch analysis from position: 207
Branch analysis from position: 208
Branch analysis from position: 87
Branch analysis from position: 80
Branch analysis from position: 75
Branch analysis from position: 71
filename:       /in/GN6KY
function name:  drawMonth
number of ops:  230
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 = $utolsoJelentkezhetoHet, !13 = $date, !14 = $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                                         $15     
         12        ASSIGN                                                   !4, $15
   10    13        INIT_FCALL                                               'getdate'
         14        SEND_VAR                                                 !4
         15        DO_ICALL                                         $17     
         16        ASSIGN                                                   !5, $17
   12    17        FETCH_DIM_R                                      ~19     !5, 'wday'
         18        ADD                                              ~20     6, ~19
         19        MOD                                              ~21     ~20, 7
         20        ADD                                              ~22     ~21, 1
         21        ASSIGN                                                   !6, ~22
   14    22        INIT_FCALL                                               'date'
         23        SEND_VAL                                                 't'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $24     
         26        ASSIGN                                                   !7, $24
   15    27        ASSIGN                                                   !8, <true>
   16    28        ASSIGN                                                   !9, 0
         29      > JMP                                                      ->209
   18    30    >   SUB                                              ~28     !9, !6
         31        ADD                                              ~29     ~28, 2
         32        ASSIGN                                                   !10, ~29
   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                                         $31     
         43        SEND_VAR                                                 $31
         44        DO_ICALL                                         $32     
         45        ASSIGN                                                   !11, $32
   20    46        INIT_FCALL                                               'date'
         47        SEND_VAL                                                 'W'
         48        SEND_VAR                                                 !4
         49        DO_ICALL                                         $34     
         50        CAST                                          4  ~35     $34
         51        CAST                                          4  ~36     !11
         52        IS_SMALLER                                               ~36, ~35
         53      > JMPZ                                                     ~37, ->55
   21    54    > > JMP                                                      ->208
   24    55    >   INIT_FCALL                                               'date'
         56        SEND_VAL                                                 'W'
         57        INIT_FCALL                                               'strtotime'
         58        SEND_VAL                                                 '%2B+28+day'
         59        DO_ICALL                                         $38     
         60        SEND_VAR                                                 $38
         61        DO_ICALL                                         $39     
         62        CAST                                          4  ~40     $39
         63        ASSIGN                                                   !12, ~40
   25    64        INIT_FCALL                                               'date'
         65        SEND_VAL                                                 'W'
         66        DO_ICALL                                         $42     
         67        CAST                                          4  ~43     $42
         68        IS_SMALLER                                               !12, ~43
         69      > JMPZ                                                     ~44, ->71
   28    70    >   ASSIGN_OP                                     1          !12, 52
   32    71    >   IS_EQUAL                                         ~46     !0, 12
         72      > JMPZ_EX                                          ~46     ~46, ->75
         73    >   IS_SMALLER_OR_EQUAL                              ~47     3, !10
         74        BOOL                                             ~46     ~47
         75    >   BOOL_NOT                                         ~48     ~46
         76      > JMPZ_EX                                          ~48     ~48, ->80
         77    >   CAST                                          4  ~49     !11
         78        IS_SMALLER                                       ~50     !12, ~49
         79        BOOL                                             ~48     ~50
         80    > > JMPZ                                                     ~48, ->83
   33    81    >   ASSIGN                                                   !8, <false>
   34    82      > JMP                                                      ->208
   36    83    >   MOD                                              ~52     !9, 7
         84        IS_EQUAL                                                 ~52, 0
         85      > JMPZ                                                     ~53, ->87
   37    86    >   ECHO                                                     '%3Ctr%3E'
   39    87    >   SUB                                              ~54     !6, 1
         88        IS_SMALLER                                               !9, ~54
         89      > JMPZ                                                     ~55, ->92
   41    90    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
         91      > JMP                                                      ->204
   42    92    >   ADD                                              ~56     !7, !6
         93        SUB                                              ~57     ~56, 1
         94        IS_SMALLER                                               !9, ~57
         95      > JMPZ                                                     ~58, ->203
   44    96    >   SUB                                              ~59     !9, !6
         97        ADD                                              ~60     ~59, 2
         98        ASSIGN                                                   !10, ~60
   45    99        INIT_FCALL                                               'date'
        100        SEND_VAL                                                 'Y-m-d'
        101        INIT_FCALL                                               'mktime'
        102        SEND_VAL                                                 0
        103        SEND_VAL                                                 0
        104        SEND_VAL                                                 0
        105        SEND_VAR                                                 !0
        106        SEND_VAR                                                 !10
        107        SEND_VAR                                                 !1
        108        DO_ICALL                                         $62     
        109        SEND_VAR                                                 $62
        110        DO_ICALL                                         $63     
        111        ASSIGN                                                   !13, $63
   46   112        ISSET_ISEMPTY_DIM_OBJ                         0          !3, !13
        113      > JMPZ                                                     ~65, ->117
        114    >   FETCH_DIM_R                                      ~66     !3, !13
        115        QM_ASSIGN                                        ~67     ~66
        116      > JMP                                                      ->118
        117    >   QM_ASSIGN                                        ~67     0
        118    >   ASSIGN                                                   !14, ~67
   47   119        ISSET_ISEMPTY_DIM_OBJ                         0          !2, !13
        120      > JMPZ                                                     ~69, ->164
   48   121    >   INIT_FCALL_BY_NAME                                       'isDayInTheFuture'
        122        SEND_VAR_EX                                              !13
        123        DO_FCALL                                      0  $70     
        124      > JMPZ                                                     $70, ->138
   49   125    >   CONCAT                                           ~71     '%3Ctd+title%3D%27Klikkelj+a+lemond%C3%A1shoz%27+id%3D%27nap-', !13
        126        CONCAT                                           ~72     ~71, '%27+class%3D%27registered%27+onclick%3D%27lemondasMegerositese%28%22'
        127        CONCAT                                           ~73     ~72, !13
        128        CONCAT                                           ~74     ~73, '%22%29%27%3E%3Cspan+class%3D%27notToday%27%3E'
        129        CONCAT                                           ~75     ~74, !10
        130        CONCAT                                           ~76     ~75, '%3C%2Fspan%3E'
        131        INIT_FCALL_BY_NAME                                       'getNapiJelentkezokHtml'
        132        SEND_VAR_EX                                              !14
        133        DO_FCALL                                      0  $77     
        134        CONCAT                                           ~78     ~76, $77
        135        CONCAT                                           ~79     ~78, '%3C%2Ftd%3E'
        136        ECHO                                                     ~79
        137      > JMP                                                      ->163
   51   138    >   INIT_FCALL_BY_NAME                                       'isToday'
        139        SEND_VAR_EX                                              !13
        140        DO_FCALL                                      0  $80     
        141      > JMPZ                                                     $80, ->153
   52   142    >   CONCAT                                           ~81     '%3Ctd+id%3D%27nap-', !13
        143        CONCAT                                           ~82     ~81, '%27+class%3D%27todayRegistered+today%27%3E%3Cspan+class%3D%27today%27%3E'
        144        CONCAT                                           ~83     ~82, !10
        145        CONCAT                                           ~84     ~83, '%3C%2Fspan%3E'
        146        INIT_FCALL_BY_NAME                                       'getNapiJelentkezokHtml'
        147        SEND_VAR_EX                                              !14
        148        DO_FCALL                                      0  $85     
        149        CONCAT                                           ~86     ~84, $85
        150        CONCAT                                           ~87     ~86, '%3C%2Ftd%3E'
        151        ECHO                                                     ~87
        152      > JMP                                                      ->163
   54   153    >   CONCAT                                           ~88     '%3Ctd+id%3D%27nap-', !13
        154        CONCAT                                           ~89     ~88, '%27+class%3D%27pastRegistered%27%3E%3Cspan+class%3D%27notToday%27%3E'
        155        CONCAT                                           ~90     ~89, !10
        156        CONCAT                                           ~91     ~90, '%3C%2Fspan%3E'
        157        INIT_FCALL_BY_NAME                                       'getNapiJelentkezokHtml'
        158        SEND_VAR_EX                                              !14
        159        DO_FCALL                                      0  $92     
        160        CONCAT                                           ~93     ~91, $92
        161        CONCAT                                           ~94     ~93, '%3C%2Ftd%3E'
        162        ECHO                                                     ~94
        163    > > JMP                                                      ->202
   58   164    >   INIT_FCALL_BY_NAME                                       'isToday'
        165        SEND_VAR_EX                                              !13
        166        DO_FCALL                                      0  $95     
        167      > JMPZ                                                     $95, ->179
   59   168    >   CONCAT                                           ~96     '%3Ctd+id%3D%27nap-', !13
        169        CONCAT                                           ~97     ~96, '%27+class%3D%27notAvailableForRegistration+today%27%3E%3Cspan+class%3D%27today%27%3E'
        170        CONCAT                                           ~98     ~97, !10
        171        CONCAT                                           ~99     ~98, '%3C%2Fspan%3E'
        172        INIT_FCALL_BY_NAME                                       'getNapiJelentkezokHtml'
        173        SEND_VAR_EX                                              !14
        174        DO_FCALL                                      0  $100    
        175        CONCAT                                           ~101    ~99, $100
        176        CONCAT                                           ~102    ~101, '%3C%2Ftd%3E'
        177        ECHO                                                     ~102
        178      > JMP                                                      ->202
   61   179    >   CONCAT                                           ~103    '%3Ctd+title%3D%27Klikkelj+a+jelentkez%C3%A9shez%27+id%3D%27nap-', !13
        180        CONCAT                                           ~104    ~103, '%27+'
   62   181        INIT_FCALL_BY_NAME                                       'isDayAvailableForRegistration'
        182        SEND_VAR_EX                                              !13
        183        SEND_VAR_EX                                              !2
        184        DO_FCALL                                      0  $105    
        185      > JMPZ                                                     $105, ->197
   63   186    >   CONCAT                                           ~106    'class%3D%27availableForRegistration%27+onclick%3D%27jelentkezesMegerositese%28%22', !13
        187        CONCAT                                           ~107    ~106, '%22%29%27%3E%3Cspan+class%3D%27notToday%27%3E'
        188        CONCAT                                           ~108    ~107, !10
        189        CONCAT                                           ~109    ~108, '%3C%2Fspan%3E'
        190        INIT_FCALL_BY_NAME                                       'getNapiJelentkezokHtml'
        191        SEND_VAR_EX                                              !14
        192        DO_FCALL                                      0  $110    
        193        CONCAT                                           ~111    ~109, $110
        194        CONCAT                                           ~112    ~111, '%3C%2Ftd%3E'
        195        QM_ASSIGN                                        ~113    ~112
        196      > JMP                                                      ->200
   64   197    >   CONCAT                                           ~114    'class%3D%27notAvailableForRegistration%27%3E%3Cspan+class%3D%27notToday%27%3E', !10
        198        CONCAT                                           ~115    ~114, '%3C%2Fspan%3E%3C%2Ftd%3E'
        199        QM_ASSIGN                                        ~113    ~115
        200    >   CONCAT                                           ~116    ~104, ~113
        201        ECHO                                                     ~116
        202    > > JMP                                                      ->204
   69   203    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   71   204    >   MOD                                              ~117    !9, 7
        205        IS_EQUAL                                                 ~117, 6
        206      > JMPZ                                                     ~118, ->208
   72   207    >   ECHO                                                     '%3C%2Ftr%3E'
   16   208    >   PRE_INC                                                  !9
        209    >   SUB                                              ~120    !6, 1
        210        ADD                                              ~121    !7, ~120
        211        IS_SMALLER                                               !9, ~121
        212      > JMPNZ                                                    ~122, ->30
   77   213    > > JMPZ_EX                                          ~123    !8, ->219
        214    >   SUB                                              ~124    !6, 1
        215        ADD                                              ~125    !7, ~124
        216        MOD                                              ~126    ~125, 7
        217        IS_SMALLER                                       ~127    0, ~126
        218        BOOL                                             ~123    ~127
        219    > > JMPZ                                                     ~123, ->229
   78   220    >   SUB                                              ~128    !6, 1
        221        ADD                                              ~129    !7, ~128
        222        MOD                                              ~130    ~129, 7
        223        ASSIGN                                                   !9, ~130
        224      > JMP                                                      ->227
   79   225    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   78   226        PRE_INC                                                  !9
        227    >   IS_SMALLER                                               !9, 7
        228      > JMPNZ                                                    ~133, ->225
   83   229    > > RETURN                                                   null

End of function drawmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.19 ms | 1423 KiB | 22 Q