3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); $a[1] = 'toto'; echo memory_get_usage() . '\n'; $a[2] = 'titi'; echo memory_get_usage() . '\n'; $a[1000000] = 'tata'; echo memory_get_usage() . '\n';
Output for 7.3.0
387664\n387696\n387696\n
Output for 7.2.0 - 7.2.13
383808\n383840\n383840\n
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25
347104\n347136\n347136\n
Output for 5.6.0 - 5.6.38
217472\n217664\n217800\n
Output for 5.5.0 - 5.5.38
217472\n217648\n217784\n
Output for 5.4.10 - 5.4.45
217992\n218168\n218304\n
Output for 5.4.0 - 5.4.9
217464\n217640\n217776\n
Output for 5.3.11 - 5.3.29
620432\n620632\n620800\n
Output for 5.3.0 - 5.3.10
620128\n620328\n620496\n
Output for 5.2.10 - 5.2.17
78072\n78264\n78424\n
Output for 5.2.7 - 5.2.9
78496\n78816\n78944\n
Output for 5.2.3 - 5.2.6
78816\n79136\n79264\n
Output for 5.2.2
76872\n77128\n77288\n
Output for 5.2.1
76872\n77032\n77192\n
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/qT1ee on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/qT1ee on line 4
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/qT1ee on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/qT1ee on line 4

preferences:
203.3 ms | 401 KiB | 287 Q