3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 'foo'; $range = range(1,100); foreach ($range as $i) { $$i = ''; } foreach ($range as $y) { $$y = ''; } var_dump($a = memory_get_usage()); foreach ($range as $i) { $$i = $foo; } var_dump($b = memory_get_usage()); foreach ($range as $y) { $$y &= $foo; } var_dump($c = memory_get_usage()); echo "Copy: " . ($b - $a) . "\n"; echo "Ref : " . ($c - $b) . "\n";
Output for 7.4.0
int(406112) int(406144) int(409344) Copy: 32 Ref : 3200
Output for 7.3.0 - 7.3.12
int(406032) int(406064) int(409264) Copy: 32 Ref : 3200
Output for 7.2.17 - 7.2.25
int(401960) int(401992) int(405192) Copy: 32 Ref : 3200
Output for 7.2.0
int(402000) int(402032) int(405232) Copy: 32 Ref : 3200
Output for 7.1.26 - 7.1.33
int(365704) int(365736) int(368936) Copy: 32 Ref : 3200
Output for 7.1.0, 7.1.7
int(365776) int(365808) int(369008) Copy: 32 Ref : 3200
Output for 7.1.5 - 7.1.6
int(366232) int(366264) int(369464) Copy: 32 Ref : 3200
Output for 7.0.3 - 7.0.20
int(365792) int(365824) int(369024) Copy: 32 Ref : 3200
Output for 7.0.0 - 7.0.2
int(365280) int(365312) int(368512) Copy: 32 Ref : 3200
Output for 5.6.7 - 5.6.28
int(250176) int(245560) int(253696) Copy: -4616 Ref : 8136
Output for 5.5.24 - 5.5.35
int(250176) int(245544) int(253680) Copy: -4632 Ref : 8136
Output for 5.4.10 - 5.4.45
int(250696) int(246064) int(254200) Copy: -4632 Ref : 8136
Output for 5.4.0 - 5.4.9
int(250168) int(245536) int(253672) Copy: -4632 Ref : 8136
Output for 5.3.11 - 5.3.29
int(659080) int(651256) int(659400) Copy: -7824 Ref : 8144
Output for 5.3.0 - 5.3.10
int(658776) int(650952) int(659096) Copy: -7824 Ref : 8144
Output for 5.2.10 - 5.2.17
int(115112) int(108080) int(115416) Copy: -7032 Ref : 7336
Output for 5.2.7 - 5.2.9
int(117536) int(117816) int(117912) Copy: 280 Ref : 96
Output for 5.2.3 - 5.2.6
int(117856) int(118136) int(118232) Copy: 280 Ref : 96
Output for 5.2.2
int(115776) int(115912) int(116048) Copy: 136 Ref : 136
Output for 5.2.1
int(114664) int(114896) int(115032) Copy: 232 Ref : 136
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/thUgD on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/thUgD on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/thUgD on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/thUgD on line 11

preferences:
165.69 ms | 401 KiB | 206 Q