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"); $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")) > 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/s758E
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     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          
   88     6      > RETURN                                                   1

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

End of function drawmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.31 ms | 1423 KiB | 22 Q