3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 100000; $i += 1) { $a[] = new ArrayObject(array("a" => "b")); } var_dump((memory_get_peak_usage(true) / 1024 / 1024) . "MB");
Output for 7.0.0 - 7.0.3, 7.0.5 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 8.3.5 - 8.3.6
string(13) "60.00390625MB"
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Out of memory (allocated 31457280 bytes) (tried to allocate 20480 bytes) in /in/H1kmh on line 5 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory zend_mm_heap corrupted
Process exited with code 134.
Output for 8.2.18
string(13) "56.00390625MB"
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.1, 8.1.28
string(13) "58.00390625MB"
Output for 8.1.2 - 8.1.6, 8.1.9 - 8.1.27
Fatal error: Out of memory (allocated 31461376) (tried to allocate 20480 bytes) in /in/H1kmh on line 5 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 1.
Output for 8.1.7 - 8.1.8
Fatal error: Out of memory (allocated 31461376) (tried to allocate 20480 bytes) in /in/H1kmh on line 5 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory zend_mm_heap corrupted
Process exited with code 1.
Output for 7.0.4

Process exited with code 137.
Output for 5.2.2, 5.2.7 - 5.2.17, 5.4.0 - 5.4.9, 5.5.0 - 5.5.36, 5.6.0 - 5.6.40
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in /in/H1kmh on line 5
Process exited with code 255.
Output for 5.5.37 - 5.5.38
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 136 bytes) in /in/H1kmh on line 5
Process exited with code 255.
Output for 5.4.10 - 5.4.45
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/H1kmh on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 8388608 bytes) in /in/H1kmh on line 5
Process exited with code 255.
Output for 5.2.1, 5.2.3 - 5.2.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/H1kmh on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_peak_usage() in /in/H1kmh on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/H1kmh on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayobject in /in/H1kmh on line 5

preferences:
282.79 ms | 401 KiB | 460 Q