3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = ['foo'=>1]; 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(347624) int(348080) int(348080) 1 int(348104) int(348104) 3
Output for 7.0.0 - 7.0.14
int(348000) int(348080) int(348080) 1 int(348104) int(348104) 3
Output for 5.6.0 - 5.6.28
int(218488) int(218760) int(218896) 1
Output for 5.5.0 - 5.5.38
int(218488) int(218776) int(218912) 1
Output for 5.4.10 - 5.4.45
int(219008) int(219296) int(219432) 1
Output for 5.4.0 - 5.4.9
int(218480) int(218768) int(218904) 1
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/RgDej 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/RgDej on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/RgDej on line 3
Process exited with code 255.