3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '10G'); $size = 2147483648; $test = str_repeat('a', $size); $x[$test] = ''; var_dump($x);
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Out of memory (allocated 2097152 bytes) (tried to allocate 2147483680 bytes) in /in/SDghN on line 4 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27
Fatal error: Out of memory (allocated 2097152) (tried to allocate 2147483680 bytes) in /in/SDghN on line 4 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 5.4.41 - 5.4.45, 5.5.25 - 5.5.38, 5.6.9 - 5.6.40
Warning: str_repeat(): Result is too big, maximum 2147483647 allowed in /in/SDghN on line 4 array(1) { [""]=> string(0) "" }
Output for 5.4.0 - 5.4.40, 5.5.0 - 5.5.24, 5.6.0 - 5.6.8
Fatal error: Out of memory (allocated 262144) (tried to allocate 2147483649 bytes) in /in/SDghN on line 4
Process exited with code 255.
Output for 4.3.0
FATAL: emalloc(): Unable to allocate -2147483647 bytes
Process exited with code 1.

preferences:
313.29 ms | 401 KiB | 382 Q