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) { $this->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 7.3.16, 7.3.23, 7.3.29 - 7.3.30, 7.4.4, 7.4.12 - 7.4.13, 7.4.27, 8.0.5, 8.0.10 - 8.0.11, 8.0.19, 8.0.22 - 8.0.30, 8.1.28, 8.3.6
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 50000032 bytes) in /in/rpSIt on line 14
Process exited with code 255.
Output for 7.1.0, 7.2.6 - 7.2.25, 7.3.0 - 7.3.12, 7.3.17 - 7.3.21, 7.3.24 - 7.3.28, 7.3.31, 7.4.0 - 7.4.3, 7.4.5 - 7.4.11, 7.4.14 - 7.4.26, 7.4.28 - 7.4.33, 8.0.0 - 8.0.3, 8.0.6 - 8.0.9, 8.0.12, 8.0.14 - 8.0.18, 8.0.20 - 8.0.21, 8.1.0 - 8.1.1, 8.2.18, 8.3.5
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 40000032 bytes) in /in/rpSIt 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 22102016 bytes) (tried to allocate 20000032 bytes) in /in/rpSIt 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
Fatal error: Out of memory (allocated 22102016) (tried to allocate 20000032 bytes) in /in/rpSIt on line 14 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 8.0.13
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 80000032 bytes) in /in/rpSIt 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
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 60000032 bytes) in /in/rpSIt on line 14
Process exited with code 255.
Output for 7.1.10

Process exited with code 137.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 60000001 bytes) in /in/rpSIt on line 14
Process exited with code 255.

preferences:
175.08 ms | 402 KiB | 213 Q