3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '64M'); define('N', 100); register_shutdown_function(function() { global $max; $y = []; for ($i = 0; $i < N; $i++) { var_dump($i); $y[] = str_repeat('asdf', $max); } var_dump('end'); }); $x = array_fill(0, N, ''); $max = 0; $i = 0; while (true) { $x[$i] .= 'asdf'; if (++$i >= N) { $i = 0; $max++; } }
Output for 7.2.0 - 7.2.33, 8.2.18 - 8.2.29, 8.3.5 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 434176 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 434176 bytes) in /in/BqfvU on line 14
Process exited with code 255.
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 208896 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) Fatal error: Out of memory (allocated 31457280 bytes) (tried to allocate 208896 bytes) in /in/BqfvU on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
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 - 8.1.33
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/BqfvU on line 14
Process exited with code 255.
Output for 8.1.2 - 8.1.27
Fatal error: Out of memory (allocated 31457280) (tried to allocate 204800 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) Fatal error: Out of memory (allocated 31457280) (tried to allocate 204800 bytes) in /in/BqfvU on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.1.25 - 7.1.32
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 438272 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 438272 bytes) in /in/BqfvU on line 14
Process exited with code 255.

preferences:
127.1 ms | 412 KiB | 5 Q