3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = 'foo'; var_dump($a = memory_get_usage()); foreach (range(1,100) as $i) { $$i = $foo; } var_dump($b = memory_get_usage()); foreach (range(1,100) as $y) { $$y &= $foo; } var_dump($c = memory_get_usage()); echo "Copy: " . ($b - $a) . "\n"; echo "Ref : " . ($c - $b) . "\n";
based on JqgM4
Output for 7.1.0
int(348160) int(357024) int(360224) Copy: 8864 Ref : 3200
Output for 7.0.3 - 7.0.14
int(348168) int(357032) int(360232) Copy: 8864 Ref : 3200
Output for 7.0.0 - 7.0.2
int(347656) int(356520) int(359720) Copy: 8864 Ref : 3200
Output for 5.6.7 - 5.6.28
int(219632) int(230064) int(238344) Copy: 10432 Ref : 8280
Output for 5.5.24 - 5.5.35
int(219632) int(230048) int(238328) Copy: 10416 Ref : 8280
Output for 5.4.10 - 5.4.45
int(220056) int(230472) int(238744) Copy: 10416 Ref : 8272
Output for 5.4.0 - 5.4.9
int(219528) int(229944) int(238216) Copy: 10416 Ref : 8272
Output for 5.3.11 - 5.3.29
int(624128) int(634560) int(642872) Copy: 10432 Ref : 8312
Output for 5.3.0 - 5.3.10
int(623824) int(634256) int(642568) Copy: 10432 Ref : 8312
Output for 5.2.10 - 5.2.17
int(81760) int(92176) int(99648) Copy: 10416 Ref : 7472
Output for 5.2.7 - 5.2.9
int(82392) int(107464) int(114912) Copy: 25072 Ref : 7448
Output for 5.2.3 - 5.2.6
int(82712) int(107784) int(115232) Copy: 25072 Ref : 7448
Output for 5.2.2
int(80640) int(105632) int(113040) Copy: 24992 Ref : 7408
Output for 5.2.1
int(80640) int(104496) int(111984) Copy: 23856 Ref : 7488
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/NrIdX on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/NrIdX on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/NrIdX on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/NrIdX on line 3