3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function foo(array $a) { echo memory_get_usage(), PHP_EOL; echo count($a), PHP_EOL; echo memory_get_usage(), PHP_EOL; } $array = range(1, 1000000); echo memory_get_usage(), PHP_EOL; foo($array); echo memory_get_usage(), PHP_EOL;
Output for 7.0.0 - 7.1.0
33905664 33905696 1000000 33905696 33905696
Output for hhvm-3.10.0 - 3.12.0
4194304 4194304 1000000 4194304 4194304
Output for 5.3.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/Q8Rua on line 9
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in /in/Q8Rua on line 9
Process exited with code 255.
Output for 5.2.1 - 5.2.2
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24 bytes) in /in/Q8Rua on line 9
Process exited with code 255.
Output for 5.1.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/Q8Rua on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/Q8Rua on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/Q8Rua on line 3
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_ARRAY, expecting ')' in /in/Q8Rua on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/Q8Rua on line 3
Process exited with code 255.