3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = 'foo'; foreach (range(1,100) as $i) { $$i = ''; } foreach (range(1,100) as $y) { $$y = ''; } 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";
Output for 7.2.0
int(394408) int(394440) int(397640) Copy: 32 Ref : 3200
Output for 7.1.0, 7.1.7
int(358184) int(358216) int(361416) Copy: 32 Ref : 3200
Output for 7.1.5 - 7.1.6
int(358704) int(358736) int(361936) Copy: 32 Ref : 3200
Output for 7.0.3 - 7.0.20
int(358200) int(358232) int(361432) Copy: 32 Ref : 3200
Output for 7.0.0 - 7.0.2
int(357688) int(357720) int(360920) Copy: 32 Ref : 3200
Output for 5.6.7 - 5.6.28
int(236336) int(231720) int(239856) Copy: -4616 Ref : 8136
Output for 5.5.24 - 5.5.35
int(236336) int(231704) int(239840) Copy: -4632 Ref : 8136
Output for 5.4.10 - 5.4.45
int(236664) int(232032) int(240168) Copy: -4632 Ref : 8136
Output for 5.4.0 - 5.4.9
int(236136) int(231504) int(239640) Copy: -4632 Ref : 8136
Output for 5.3.11 - 5.3.29
int(645328) int(637504) int(645648) Copy: -7824 Ref : 8144
Output for 5.3.0 - 5.3.10
int(645024) int(637200) int(645344) Copy: -7824 Ref : 8144
Output for 5.2.10 - 5.2.17
int(102144) int(95112) int(102448) Copy: -7032 Ref : 7336
Output for 5.2.7 - 5.2.9
int(117552) int(117792) int(117888) Copy: 240 Ref : 96
Output for 5.2.3 - 5.2.6
int(117872) int(118112) int(118208) Copy: 240 Ref : 96
Output for 5.2.2
int(115792) int(115968) int(116064) Copy: 176 Ref : 96
Output for 5.2.1
int(114768) int(115040) int(115136) Copy: 272 Ref : 96
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/2WUEh on line 10
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/2WUEh on line 10
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/2WUEh on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/2WUEh on line 10

preferences:
148.77 ms | 401 KiB | 175 Q