3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = strtotime('2014-09-15'); $end = strtotime('2014-11-15'); $stamp = $start; $months = array(); do { $next_stamp = mktime(0,0,0, date('n',$stamp)+1, 1, date('Y',$stamp)); $next_stamp = min($next_stamp, $end); $months[] = date('Y-m-d H:i:s', $next_stamp)." ".date('Y-m-d H:i:s', $stamp).floor(($next_stamp-$stamp)/3600/24)/date('t', $stamp)." ".date('t', $stamp)." ".($next_stamp-$stamp); $stamp = $next_stamp; } while ($stamp <= $end); var_dump($months);
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Out of memory (allocated 27267072 bytes) (tried to allocate 8388616 bytes) in /in/tRRUN 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 31461376) (tried to allocate 16777224 bytes) in /in/tRRUN on line 10 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 5.6.28, 7.0.0 - 7.0.1, 7.0.5, 7.0.9 - 7.0.20, 7.1.0 - 7.1.20, 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

Process exited with code 137.
Output for 7.0.2 - 7.0.4, 7.0.6 - 7.0.8, 7.2.0 - 7.2.6, 7.4.5
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/tRRUN on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.24
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/tRRUN on line 8
Process exited with code 255.

preferences:
160.46 ms | 402 KiB | 265 Q