3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = strtotime('2014-09-01'); $end = strtotime('2014-10-01'); $stamp = $start; $months = array(); do { $next_stamp = mktime(0,0,-1, date('n',$stamp)+1, 1, date('Y',$stamp)); $next_stamp = min($next_stamp, $end); $months[] = (($next_stamp-$stamp)/3600/24)/date('t', $stamp); $stamp = $next_stamp; } while ($stamp < $end); var_dump($months);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.4, 7.4.6 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.1, 8.1.28, 8.2.0 - 8.2.11, 8.2.16 - 8.2.18, 8.3.3 - 8.3.6

Process exited with code 137.
Output for 8.2.12 - 8.2.15, 8.3.0 - 8.3.2
Fatal error: Out of memory (allocated 18878464 bytes) (tried to allocate 33554440 bytes) in /in/3GJje on line 10 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.1.2 - 8.1.27
Fatal error: Out of memory (allocated 18878464) (tried to allocate 33554440 bytes) in /in/3GJje on line 10 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.4.5
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 67108872 bytes) in /in/3GJje on line 10
Process exited with code 255.
Output for 7.2.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 67108872 bytes) in /in/3GJje on line 10
Process exited with code 137.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.23
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/3GJje on line 8
Process exited with code 255.

preferences:
212.06 ms | 402 KiB | 265 Q