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; } 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; } 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(12, 2012, array(), array()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/82Q6X
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                                                 12
          2        SEND_VAL                                                 2012
          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 = 121
Branch analysis from position: 121
2 jumps found. (Code = 44) Position 1 = 125, Position 2 = 30
Branch analysis from position: 125
2 jumps found. (Code = 46) Position 1 = 126, Position 2 = 131
Branch analysis from position: 126
2 jumps found. (Code = 43) Position 1 = 132, Position 2 = 141
Branch analysis from position: 132
1 jumps found. (Code = 42) Position 1 = 139
Branch analysis from position: 139
2 jumps found. (Code = 44) Position 1 = 141, Position 2 = 137
Branch analysis from position: 141
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 137
2 jumps found. (Code = 44) Position 1 = 141, Position 2 = 137
Branch analysis from position: 141
Branch analysis from position: 137
Branch analysis from position: 141
Branch analysis from position: 131
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 = 120
Branch analysis from position: 120
2 jumps found. (Code = 44) Position 1 = 125, Position 2 = 30
Branch analysis from position: 125
Branch analysis from position: 30
Branch analysis from position: 55
2 jumps found. (Code = 46) Position 1 = 66, Position 2 = 68
Branch analysis from position: 66
2 jumps found. (Code = 46) Position 1 = 70, Position 2 = 73
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 76
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 120
Branch analysis from position: 120
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 80
Branch analysis from position: 79
2 jumps found. (Code = 43) Position 1 = 83, Position 2 = 85
Branch analysis from position: 83
1 jumps found. (Code = 42) Position 1 = 116
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 = 44) Position 1 = 125, Position 2 = 30
Branch analysis from position: 125
Branch analysis from position: 30
Branch analysis from position: 120
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 115
Branch analysis from position: 89
2 jumps found. (Code = 43) Position 1 = 107, Position 2 = 110
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 111
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 116
Branch analysis from position: 116
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 119, Position 2 = 120
Branch analysis from position: 119
Branch analysis from position: 120
Branch analysis from position: 80
Branch analysis from position: 73
Branch analysis from position: 68
filename:       /in/82Q6X
function name:  drawMonth
number of ops:  142
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                                                      ->121
   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                                                      ->120
   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
   32    64        IS_EQUAL                                         ~42     !0, 12
         65      > JMPZ_EX                                          ~42     ~42, ->68
         66    >   IS_SMALLER_OR_EQUAL                              ~43     3, !10
         67        BOOL                                             ~42     ~43
         68    >   BOOL_NOT                                         ~44     ~42
         69      > JMPZ_EX                                          ~44     ~44, ->73
         70    >   CAST                                          4  ~45     !11
         71        IS_SMALLER                                       ~46     !12, ~45
         72        BOOL                                             ~44     ~46
         73    > > JMPZ                                                     ~44, ->76
   33    74    >   ASSIGN                                                   !8, <false>
   34    75      > JMP                                                      ->120
   36    76    >   MOD                                              ~48     !9, 7
         77        IS_EQUAL                                                 ~48, 0
         78      > JMPZ                                                     ~49, ->80
   37    79    >   ECHO                                                     '%3Ctr%3E'
   39    80    >   SUB                                              ~50     !6, 1
         81        IS_SMALLER                                               !9, ~50
         82      > JMPZ                                                     ~51, ->85
   41    83    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
         84      > JMP                                                      ->116
   42    85    >   ADD                                              ~52     !7, !6
         86        SUB                                              ~53     ~52, 1
         87        IS_SMALLER                                               !9, ~53
         88      > JMPZ                                                     ~54, ->115
   44    89    >   SUB                                              ~55     !9, !6
         90        ADD                                              ~56     ~55, 2
         91        ASSIGN                                                   !10, ~56
   45    92        INIT_FCALL                                               'date'
         93        SEND_VAL                                                 'Y-m-d'
         94        INIT_FCALL                                               'mktime'
         95        SEND_VAL                                                 0
         96        SEND_VAL                                                 0
         97        SEND_VAL                                                 0
         98        SEND_VAR                                                 !0
         99        SEND_VAR                                                 !10
        100        SEND_VAR                                                 !1
        101        DO_ICALL                                         $58     
        102        SEND_VAR                                                 $58
        103        DO_ICALL                                         $59     
        104        ASSIGN                                                   !13, $59
   46   105        ISSET_ISEMPTY_DIM_OBJ                         0          !3, !13
        106      > JMPZ                                                     ~61, ->110
        107    >   FETCH_DIM_R                                      ~62     !3, !13
        108        QM_ASSIGN                                        ~63     ~62
        109      > JMP                                                      ->111
        110    >   QM_ASSIGN                                        ~63     0
        111    >   ASSIGN                                                   !14, ~63
   67   112        CONCAT                                           ~65     !10, 'nap+'
        113        ECHO                                                     ~65
        114      > JMP                                                      ->116
   70   115    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   72   116    >   MOD                                              ~66     !9, 7
        117        IS_EQUAL                                                 ~66, 6
        118      > JMPZ                                                     ~67, ->120
   73   119    >   ECHO                                                     '%3C%2Ftr%3E'
   16   120    >   PRE_INC                                                  !9
        121    >   SUB                                              ~69     !6, 1
        122        ADD                                              ~70     !7, ~69
        123        IS_SMALLER                                               !9, ~70
        124      > JMPNZ                                                    ~71, ->30
   78   125    > > JMPZ_EX                                          ~72     !8, ->131
        126    >   SUB                                              ~73     !6, 1
        127        ADD                                              ~74     !7, ~73
        128        MOD                                              ~75     ~74, 7
        129        IS_SMALLER                                       ~76     0, ~75
        130        BOOL                                             ~72     ~76
        131    > > JMPZ                                                     ~72, ->141
   79   132    >   SUB                                              ~77     !6, 1
        133        ADD                                              ~78     !7, ~77
        134        MOD                                              ~79     ~78, 7
        135        ASSIGN                                                   !9, ~79
        136      > JMP                                                      ->139
   80   137    >   ECHO                                                     '%3Ctd+class%3D%27noborder%27%3E%3C%2Ftd%3E'
   79   138        PRE_INC                                                  !9
        139    >   IS_SMALLER                                               !9, 7
        140      > JMPNZ                                                    ~82, ->137
   84   141    > > RETURN                                                   null

End of function drawmonth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.29 ms | 1402 KiB | 22 Q