3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = ['foo'=>1, 'bar'=> 2]; var_dump(memory_get_usage()); foreach($array as $k=>&$v) { var_dump(memory_get_usage()); $array['baz']=3; var_dump(memory_get_usage()); echo $v . "\n"; }
Output for 7.1.0
int(347656) int(348112) int(348112) 1 int(348136) int(348136) 2 int(348160) int(348160) 3
Output for 7.0.0 - 7.0.14
int(348032) int(348112) int(348112) 1 int(348136) int(348136) 2 int(348160) int(348160) 3
Output for hhvm-3.10.0 - 3.12.0
int(2097152) int(2097152) int(2097152) 1 int(2097152) int(2097152) 2 int(2097152) int(2097152) 3
Output for 5.6.0 - 5.6.28
int(218752) int(219024) int(219160) 1 int(219160) int(219160) 2 int(219160) int(219160) 3
Output for 5.5.0 - 5.5.38
int(218752) int(219040) int(219176) 1 int(219176) int(219176) 2 int(219176) int(219176) 3
Output for 5.4.10 - 5.4.45
int(219272) int(219560) int(219696) 1 int(219696) int(219696) 2 int(219696) int(219696) 3
Output for 5.4.0 - 5.4.9
int(218744) int(219032) int(219168) 1 int(219168) int(219168) 2 int(219168) int(219168) 3
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/1G7Ck on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/1G7Ck on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/1G7Ck on line 3
Process exited with code 255.