3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = ['foo'=>1]; $last = $current = memory_get_usage(); foreach($array as $k=>&$v) { $last = $current; $current = memory_get_usage(); echo "Diff is " . ($current - $last) . "\n"; $array['baz']=3; $last = $current; $current = memory_get_usage(); echo "Diff is " . ($current - $last) . "\n"; echo $v . "\n"; }
Output for 7.1.0
Diff is 424 Diff is 32 1 Diff is 24 Diff is 0 3
Output for 7.0.0 - 7.0.14
Diff is 48 Diff is 32 1 Diff is 24 Diff is 0 3
Output for hhvm-3.10.0 - 3.12.0
Diff is 0 Diff is 0 1 Diff is 0 Diff is 0 3
Output for 5.6.7 - 5.6.21
Diff is 448 Diff is 184 1
Output for 5.4.0 - 5.5.35
Diff is 480 Diff is 168 1
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/iODrh 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/iODrh on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/iODrh on line 3
Process exited with code 255.