3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data=array(); for($c=0; $c<1000; $c++) $data[$c]=array(1, 2, 3); $filter=array(1, 2, 3); for($kc=0; $kc<3; $kc++) { $cm=memory_get_usage(true); $pm=memory_get_peak_usage(true); echo "loop $kc: current_memory: $cm, peak_memory: $pm...\n"; flush(); foreach($data as $entry) foreach($filter as $pattern) continue 2; } ?>
Output for 7.0.0 - 7.1.0
loop 0: current_memory: 2097152, peak_memory: 2097152... loop 1: current_memory: 2097152, peak_memory: 2097152... loop 2: current_memory: 2097152, peak_memory: 2097152...
Output for hhvm-3.12.0
loop 0: current_memory: 321472, peak_memory: 321472... loop 1: current_memory: 321472, peak_memory: 321472... loop 2: current_memory: 321472, peak_memory: 321472...
Output for hhvm-3.10.0
loop 0: current_memory: 319832, peak_memory: 319832... loop 1: current_memory: 319832, peak_memory: 319832... loop 2: current_memory: 319832, peak_memory: 319832...
Output for 5.4.0 - 5.6.28
loop 0: current_memory: 1048576, peak_memory: 1048576... loop 1: current_memory: 1048576, peak_memory: 1048576... loop 2: current_memory: 1048576, peak_memory: 1048576...
Output for 5.3.0 - 5.3.29
loop 0: current_memory: 1572864, peak_memory: 1572864... loop 1: current_memory: 1572864, peak_memory: 1572864... loop 2: current_memory: 1572864, peak_memory: 1572864...
Output for 5.2.1 - 5.2.17
loop 0: current_memory: 786432, peak_memory: 786432... loop 1: current_memory: 786432, peak_memory: 786432... loop 2: current_memory: 786432, peak_memory: 786432...
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/Pb9M8 on line 9
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/Pb9M8 on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/Pb9M8 on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/Pb9M8 on line 9