3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Everything you enter here will be executed by our servers. Try it! function getMemoryUsage() { return round(memory_get_usage() / (1024*1024), 1)." MB"; } function printMemoryUsage() { print("Memory = ".getMemoryUsage()." <br>\n"); } printMemoryUsage(); $end = 1000000; $array = array(); printMemoryUsage(); for($i = 0; $i < $end; $i++) { $array[$i] = 0; } printMemoryUsage(); ?>
Output for 7.0.0 - 7.1.0
Memory = 0.3 MB <br> Memory = 0.3 MB <br> Memory = 32.3 MB <br>
Output for 5.4.0 - 5.6.28
Memory = 0.2 MB <br> Memory = 0.2 MB <br> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/Soed7 on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Memory = 0.6 MB <br> Memory = 0.6 MB <br> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/Soed7 on line 20
Process exited with code 255.
Output for 5.2.6 - 5.2.17
Memory = 0.1 MB <br> Memory = 0.1 MB <br> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/Soed7 on line 20
Process exited with code 255.
Output for 5.2.1 - 5.2.5
Memory = 0.1 MB <br> Memory = 0.1 MB <br> Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/Soed7 on line 20
Process exited with code 255.
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/Soed7 on line 7
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/Soed7 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/Soed7 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: memory_get_usage() in /in/Soed7 on line 7