3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '64M'); define('N', 100); register_shutdown_function(function() { global $max; ini_set('memory_limit', '256M'); $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.2.18, 8.3.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 434176 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) Fatal error: Out of memory (allocated 85983232 bytes) (tried to allocate 434176 bytes) in /in/Ug1pq on line 16 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 434176 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) Fatal error: Out of memory (allocated 85983232 bytes) (tried to allocate 434176 bytes) in /in/Ug1pq on line 16 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/Ug1pq on line 29 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/Ug1pq on line 16 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.23 - 7.3.31, 7.3.33, 8.0.0, 8.1.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) Fatal error: Out of memory (allocated 88080384) (tried to allocate 425984 bytes) in /in/Ug1pq on line 16 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
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/Ug1pq on line 29 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/Ug1pq on line 16 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.1.0 - 8.1.1
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) Fatal error: Out of memory (allocated 81788928) (tried to allocate 425984 bytes) in /in/Ug1pq on line 16 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.0.1 - 8.0.12, 8.0.14 - 8.0.30
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) Fatal error: Out of memory (allocated 83886080) (tried to allocate 425984 bytes) in /in/Ug1pq on line 16 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.3.0 - 7.3.21, 7.3.32, 7.4.0 - 7.4.11, 7.4.26, 7.4.33, 8.0.13
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) int(44) int(45) int(46) int(47) int(48) int(49) int(50) int(51) int(52) int(53) int(54) int(55) int(56) int(57) int(58) int(59) int(60) int(61) int(62) int(63) int(64) int(65) int(66) int(67) int(68) int(69) int(70) int(71) int(72) int(73) int(74) int(75) int(76) int(77) int(78) int(79) int(80) int(81) int(82) int(83) int(84) int(85) int(86) int(87) int(88) int(89) int(90) int(91) int(92) int(93) int(94) int(95) int(96) int(97) int(98) int(99) string(3) "end"
Process exited with code 255.
Output for 7.4.12 - 7.4.25, 7.4.27 - 7.4.32
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 425984 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) Fatal error: Out of memory (allocated 85983232) (tried to allocate 425984 bytes) in /in/Ug1pq on line 16 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.2.0 - 7.2.33
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 434176 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) int(44) int(45) int(46) int(47) int(48) int(49) int(50) int(51) int(52) int(53) int(54) int(55) int(56) int(57) int(58) int(59) int(60) int(61) int(62) int(63) int(64) int(65) int(66) int(67) int(68) int(69) int(70) int(71) int(72) int(73) int(74) int(75) int(76) int(77) int(78) int(79) int(80) int(81) int(82) int(83) int(84) int(85) int(86) int(87) int(88) int(89) int(90) int(91) int(92) int(93) int(94) int(95) int(96) int(97) int(98) int(99) string(3) "end"
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.32
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 438272 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) int(44) int(45) int(46) int(47) int(48) int(49) int(50) int(51) int(52) int(53) int(54) int(55) int(56) int(57) int(58) int(59) int(60) int(61) int(62) int(63) int(64) int(65) int(66) int(67) int(68) int(69) int(70) int(71) int(72) int(73) int(74) int(75) int(76) int(77) int(78) int(79) int(80) int(81) int(82) int(83) int(84) int(85) int(86) int(87) int(88) int(89) int(90) int(91) int(92) int(93) int(94) int(95) int(96) int(97) int(98) int(99) string(3) "end"
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.20, 5.6.22 - 5.6.40
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 524241 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5) int(6) int(7) int(8) int(9) int(10) int(11) int(12) int(13) int(14) int(15) int(16) int(17) int(18) int(19) int(20) int(21) int(22) int(23) int(24) int(25) int(26) int(27) int(28) int(29) int(30) int(31) int(32) int(33) int(34) int(35) int(36) int(37) int(38) int(39) int(40) int(41) int(42) int(43) int(44) int(45) int(46) int(47) int(48) int(49) int(50) int(51) int(52) int(53) int(54) int(55) int(56) int(57) int(58) int(59) int(60) int(61) int(62) int(63) int(64) int(65) int(66) int(67) int(68) int(69) int(70) int(71) int(72) int(73) int(74) int(75) int(76) int(77) int(78) int(79) int(80) int(81) int(82) int(83) int(84) int(85) int(86) int(87) int(88) int(89) int(90) int(91) int(92) int(93) int(94) int(95) int(96) int(97) int(98) int(99) string(3) "end"
Process exited with code 255.
Output for 5.6.21
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 524241 bytes) in /in/Ug1pq on line 29 int(0) int(1) int(2) int(3) int(4) int(5)
Process exited with code 137.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Ug1pq on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/Ug1pq on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/Ug1pq on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/Ug1pq on line 7
Process exited with code 255.

preferences:
321.2 ms | 401 KiB | 445 Q