3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $currentMonth = date("n"); $currentYear = date("Y"); echo $currentMonth . "\n"; echo $currentYear . "\n"; $month = $currentMonth; $year = $currentYear; $firstDayOfTheMonth = mktime(0, 0, 0, $month, 1, $year); $d = getdate($firstDayOfTheMonth); // Vasarnap helyett hetfo az elso nap a heten. $dayOfTheWeekOfFirstDayOfTheMonth = (6 + $d["wday"]) % 7 + 1; $totalDaysInCurrentMonth = date("t"); $kellenekUresNapokAHonapVegen = true; echo $firstDayOfTheMonth . "firstDayOfTheMonth\n"; //echo $d . "d\n"; echo $dayOfTheWeekOfFirstDayOfTheMonth . "dayOfTheWeekOfFirstDayOfTheMonth\n"; echo $totalDaysInCurrentMonth . "totalDaysInCurrentMonth\n"; 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; echo '$day: ' . $day ."\n"; $dateWeek = date("W", mktime(0, 0, 0, $month, $day, $year)); echo '$dateWeek: ' . $dateWeek ."\n"; if (intval(date("W")) > intval($dateWeek)) { echo "CONTINUE1\n"; 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"))); echo "utolsoJelentkezhetoHet: " .$utolsoJelentkezhetoHet. "\n"; if (intval($dateWeek) > $utolsoJelentkezhetoHet) { $kellenekUresNapokAHonapVegen = false; echo "CONTINUE2\n"; 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>"; } } ?>

Abusive script

This script was stopped while abusing our resources

Output for 5.3.0 - 5.4.9
5 2014 1398895200firstDayOfTheMonth 4dayOfTheWeekOfFirstDayOfTheMonth 31totalDaysInCurrentMonth $day: -2 $dateWeek: 18 CONTINUE1 $day: -1 $dateWeek: 18 CONTINUE1 $day: 0 $dateWeek: 18 CONTINUE1 $day: 1 $dateWeek: 18 CONTINUE1 $day: 2 $dateWeek: 18 CONTINUE1 $day: 3 $dateWeek: 18 CONTINUE1 $day: 4 $dateWeek: 18 CONTINUE1 $day: 5 $dateWeek: 19 CONTINUE1 $day: 6 $dateWeek: 19 CONTINUE1 $day: 7 $dateWeek: 19 CONTINUE1 $day: 8 $dateWeek: 19 CONTINUE1 $day: 9 $dateWeek: 19 CONTINUE1 $day: 10 $dateWeek: 19 CONTINUE1 $day: 11 $dateWeek: 19 CONTINUE1 $day: 12 $dateWeek: 20 CONTINUE1 $day: 13 $dateWeek: 20 CONTINUE1 $day: 14 $dateWeek: 20 CONTINUE1 $day: 15 $dateWeek: 20 CONTINUE1 $day: 16 $dateWeek: 20 CONTINUE1 $day: 17 $dateWeek: 20 CONTINUE1 $day: 18 $dateWeek: 20 CONTINUE1 $day: 19 $dateWeek: 21 CONTINUE1 $day: 20 $dateWeek: 21 CONTINUE1 $day: 21 $dateWeek: 21 CONTINUE1 $day: 22 $dateWeek: 21 CONTINUE1 $day: 23 $dateWeek: 21 CONTINUE1 $day: 24 $dateWeek: 21 CONTINUE1 $day: 25 $dateWeek: 21 CONTINUE1 $day: 26 $dateWeek: 22 utolsoJelentkezhetoHet: 26 <tr> Fatal error: Call to undefined function isToday() in /in/kAivZ on line 65
Process exited with code 255.