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 7.0.0 - 7.0.33, 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.27, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
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.