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 8.5.0
Fatal error: Out of memory (allocated 39845888 bytes) (tried to allocate 258048 bytes) in /in/BqfvU on line 27 Stack trace: #0 {main} int(0) int(1) int(2) int(3) int(4) int(5) int(6) Fatal error: Out of memory (allocated 39845888 bytes) (tried to allocate 258048 bytes) in /in/BqfvU on line 14 Stack trace: #0 /in/BqfvU(14): str_repeat('asdf', 63481) #1 [internal function]: {closure:/in/BqfvU:7}() #2 {main} 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 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.2.0 - 7.2.33, 8.2.18 - 8.2.29, 8.3.5 - 8.3.27, 8.4.1 - 8.4.14
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.3.28
Fatal error: Out of memory (allocated 48234496 bytes) (tried to allocate 315392 bytes) in /in/BqfvU on line 27 int(0) int(1) int(2) int(3) int(4) int(5) Fatal error: Out of memory (allocated 48234496 bytes) (tried to allocate 315392 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 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:
180.39 ms | 418 KiB | 5 Q