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>"); } }*/ 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/4iei9
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 = 128
Branch analysis from position: 128
2 jumps found. (Code = 44) Position 1 = 132, Position 2 = 30
Branch analysis from position: 132
2 jumps found. (Code = 46) Position 1 = 133, Position 2 = 138
Branch analysis from position: 133
2 jumps found. (Code = 43) Position 1 = 139, Position 2 = 148
Branch analysis from position: 139
1 jumps found. (Code = 42) Position 1 = 146
Branch analysis from position: 146
2 jumps found. (Code = 44) Position 1 = 148, Position 2 = 144
Branch analysis from position: 148
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 144
2 jumps found. (Code = 44) Position 1 = 148, Position 2 = 144
Branch analysis from position: 148
Branch analysis from position: 144
Branch analysis from position: 148
Branch analysis from position: 138
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 = 127
Branch analysis from position: 127
2 jumps found. (Code = 44) Position 1 = 132, Position 2 = 30
Branch analysis from position: 132
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 = 127
Branch analysis from position: 127
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 = 123
Branch analysis from position: 123
2 jumps found. (Code = 43) Position 1 = 126, Position 2 = 127
Branch analysis from position: 126
2 jumps found. (Code = 44) Position 1 = 132, Position 2 = 30
Branch analysis from position: 132
Branch analysis from position: 30
Branch analysis from position: 127
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 96, Position 2 = 122
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
1 jumps found. (Code = 42) Position 1 = 123
Branch analysis from position: 123
Branch analysis from position: 117
1 jumps found. (Code = 42) Position 1 = 123
Branch analysis from position: 123
Branch analysis from position: 122
2 jumps found. (Code = 43) Position 1 = 126, Position 2 = 127
Branch analysis from position: 126
Branch analysis from position: 127
Branch analysis from position: 87
Branch analysis from position: 80
Branch analysis from position: 75
Branch analysis from position: 71
filename:       /in/4iei9
function name:  drawMonth
number of ops:  149
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                                                      ->128
   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                                                      ->127
   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                                                      ->127
   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                                                      ->123
   42    92    >   ADD                                              ~56     !7, !6
         93        SUB                                              ~57     ~56, 1
         94        IS_SMALLER                                               !9, ~57
         95      > JMPZ                                                     ~58, ->122
   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
   67   119        CONCAT                                           ~69     !10, 'nap+'
        120        ECHO                                                     ~69
        121      > JMP                                                      ->123
   70   122    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   72   123    >   MOD                                              ~70     !9, 7
        124        IS_EQUAL                                                 ~70, 6
        125      > JMPZ                                                     ~71, ->127
   73   126    >   ECHO                                                     '%3C%2Ftr%3E'
   16   127    >   PRE_INC                                                  !9
        128    >   SUB                                              ~73     !6, 1
        129        ADD                                              ~74     !7, ~73
        130        IS_SMALLER                                               !9, ~74
        131      > JMPNZ                                                    ~75, ->30
   78   132    > > JMPZ_EX                                          ~76     !8, ->138
        133    >   SUB                                              ~77     !6, 1
        134        ADD                                              ~78     !7, ~77
        135        MOD                                              ~79     ~78, 7
        136        IS_SMALLER                                       ~80     0, ~79
        137        BOOL                                             ~76     ~80
        138    > > JMPZ                                                     ~76, ->148
   79   139    >   SUB                                              ~81     !6, 1
        140        ADD                                              ~82     !7, ~81
        141        MOD                                              ~83     ~82, 7
        142        ASSIGN                                                   !9, ~83
        143      > JMP                                                      ->146
   80   144    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   79   145        PRE_INC                                                  !9
        146    >   IS_SMALLER                                               !9, 7
        147      > JMPNZ                                                    ~86, ->144
   84   148    > > RETURN                                                   null

End of function drawmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.07 ms | 1406 KiB | 22 Q