3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mem_start = memory_get_usage(true); echo 'start: ' . $mem_start . PHP_EOL; class Foo { public static function bar() { return new Foo; } } $max_iterations = 10000; for ($i = 1; $i <= $max_iterations; $i++) { //DateTime::createFromFormat('M/D/Y H:i:s', '2013-11-12 20:00:00'); Foo::bar(); if (($i % 1000) == 0) { echo $i . '.: ' . memory_get_usage(true) . PHP_EOL; } } $mem_end = memory_get_usage(true); echo 'end: ' . $mem_end . PHP_EOL; echo 'diff end-start: ' . ($mem_end - $mem_start) . PHP_EOL;
Output for 7.0.0 - 7.1.0
start: 2097152 1000.: 2097152 2000.: 2097152 3000.: 2097152 4000.: 2097152 5000.: 2097152 6000.: 2097152 7000.: 2097152 8000.: 2097152 9000.: 2097152 10000.: 2097152 end: 2097152 diff end-start: 0
Output for hhvm-3.12.0
start: 306488 1000.: 306552 2000.: 306584 3000.: 306616 4000.: 306616 5000.: 306616 6000.: 306616 7000.: 306616 8000.: 306616 9000.: 306616 10000.: 306632 end: 306584 diff end-start: 96
Output for hhvm-3.10.0
start: 304864 1000.: 304928 2000.: 304960 3000.: 304992 4000.: 304992 5000.: 304992 6000.: 304992 7000.: 304992 8000.: 304992 9000.: 304992 10000.: 305008 end: 304960 diff end-start: 96
Output for 5.2.1 - 5.2.17, 5.4.0 - 5.6.28
start: 262144 1000.: 262144 2000.: 262144 3000.: 262144 4000.: 262144 5000.: 262144 6000.: 262144 7000.: 262144 8000.: 262144 9000.: 262144 10000.: 262144 end: 262144 diff end-start: 0
Output for 5.3.0 - 5.3.29
start: 786432 1000.: 786432 2000.: 786432 3000.: 786432 4000.: 786432 5000.: 786432 6000.: 786432 7000.: 786432 8000.: 786432 9000.: 786432 10000.: 786432 end: 786432 diff end-start: 0
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/qP0UE on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/qP0UE on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/qP0UE on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/qP0UE on line 6
Process exited with code 255.