3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 100; $arr = array_fill(0, $max, 1); $mem = memory_get_usage(true); foreach ($arr as $key=>$val) { $arr[$max+1] = 9999; } echo $mem-memory_get_usage();
Output for 7.3.0 - 7.3.1
1701280
Output for 7.2.0 - 7.2.13
1705256
Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.1, 7.1.7 - 7.1.25
1741992
Output for 7.1.2 - 7.1.6
1741792
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
33592
Output for 5.4.10 - 5.4.45
33072
Output for 5.4.0 - 5.4.9
33600
Output for 5.3.11 - 5.3.29
155136
Output for 5.3.0 - 5.3.10
155440
Output for 5.2.10 - 5.2.17
173240
Output for 5.2.7 - 5.2.9
162632
Output for 5.2.3 - 5.2.6
162312
Output for 5.2.2
164264
Output for 5.2.1
164792
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/sTCt9 on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/sTCt9 on line 5
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/sTCt9 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/sTCt9 on line 5

preferences:
234.57 ms | 401 KiB | 285 Q