3v4l.org

run code in 300+ PHP versions simultaneously
<?php function daysInMonth($month, $year) { $daysBetweenMonths = [0, 31, 59 + ($year%4 === 0), 90, 120, 151, 181, 212, 243, 273, 304, 334, 365]; $prev = $daysBetweenMonths[$month - 2]; $current = $daysBetweenMonths[$month - 1]; return $current - $prev; } for ($y = 2000; $y < 2004; $y++) for ($m = 1; $m < 13; $m++) { echo 'dais in '.$m.'/'.$y.' are :'. daysInMonth($m, $y)."\n"; } echo "\n\n"; }
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected '}' in /in/Gp15l on line 18
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/Gp15l on line 4
Process exited with code 255.

preferences:
189.77 ms | 1394 KiB | 65 Q