3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A1 { var $s; protected function a () { $i =0 ; while (true) { $i++; if ($i > 10000) { break; } foreach ([['a' => 1],2, ['a' => 2]] as $p) { if ($p == 2) { continue; } if ($i %100 == 0) { $s .= str_repeat('0123456789', 1000000); } yield $p['a'] => 123; } } } public function b(){ $sum = 0; foreach ( $this->a() as $k => $v ) { $sum += $k + $v; } echo 'Done: ', $sum; }} (new A1)->b();
Output for 8.0.0 - 8.0.2, 8.0.5 - 8.0.8, 8.0.10 - 8.0.12, 8.0.15 - 8.0.16, 8.0.18, 8.0.20 - 8.0.25, 8.1.0 - 8.1.1, 8.2.18, 8.3.7
Warning: Undefined variable $s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 40000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 8.0.3, 8.0.9, 8.0.14, 8.0.17, 8.0.19, 8.0.26 - 8.0.30, 8.1.28, 8.3.5 - 8.3.6
Warning: Undefined variable $s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 50000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $s in /in/9NIiB on line 14 Fatal error: Out of memory (allocated 22102016 bytes) (tried to allocate 20000032 bytes) in /in/9NIiB on line 14 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
Warning: Undefined variable $s in /in/9NIiB on line 14 Fatal error: Out of memory (allocated 22102016) (tried to allocate 20000032 bytes) in /in/9NIiB on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 8.0.13
Warning: Undefined variable $s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 80000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 7.3.19 - 7.3.20, 7.3.23, 7.3.28, 7.4.4, 7.4.8, 7.4.10, 7.4.16, 7.4.27, 7.4.33
Notice: Undefined variable: s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 50000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 7.1.0, 7.2.6 - 7.2.25, 7.3.0 - 7.3.18, 7.3.21, 7.3.24 - 7.3.27, 7.3.29 - 7.3.31, 7.4.0 - 7.4.3, 7.4.5 - 7.4.7, 7.4.9, 7.4.11 - 7.4.15, 7.4.20 - 7.4.26, 7.4.28 - 7.4.32
Notice: Undefined variable: s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 40000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 80000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.5 - 7.1.7, 7.1.20 - 7.1.33, 7.2.0, 7.2.29 - 7.2.33
Notice: Undefined variable: s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 60000032 bytes) in /in/9NIiB on line 14
Process exited with code 255.
Output for 7.1.10
Notice: Undefined variable: s in /in/9NIiB on line 14
Process exited with code 137.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Undefined variable: s in /in/9NIiB on line 14 Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 60000001 bytes) in /in/9NIiB on line 14
Process exited with code 255.

preferences:
215.16 ms | 402 KiB | 214 Q