3v4l.org

run code in 300+ PHP versions simultaneously
<?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, 100000); echo memory_get_usage(), PHP_EOL; foo($array); echo memory_get_usage(), PHP_EOL;
Output for 7.4.0 - 7.4.1
4585896 4585928 100000 4585928 4585928
Output for 7.3.0 - 7.3.13
4585872 4585904 100000 4585904 4585904
Output for 7.2.0 - 7.2.26
4582056 4582088 100000 4582088 4582088
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
4545464 4545496 100000 4545496 4545496
Output for 5.6.0 - 5.6.40
14867760 14867848 100000 14867848 14867848
Output for 5.5.0 - 5.5.38
14867760 14867832 100000 14867832 14867832
Output for 5.4.0 - 5.4.45
14868312 14868384 100000 14868384 14868384
Output for 5.3.11 - 5.3.29
15270504 15270536 100000 15270536 15270536
Output for 5.3.0 - 5.3.10
15270184 15270216 100000 15270216 15270216
Output for 5.2.10 - 5.2.17
13929992 13930288 100000 13930288 13930192
Output for 5.2.7 - 5.2.9
13931616 13931840 100000 13931936 13931936
Output for 5.2.6
13931952 13932176 100000 13932272 13932272
Output for 5.2.3 - 5.2.5
13931904 13932128 100000 13932224 13932224
Output for 5.2.2
13929232 13929416 100000 13929512 13929512
Output for 5.2.1
13929328 13929512 100000 13929512 13929512
Output for 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/kSWZJ 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/kSWZJ 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/kSWZJ on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_ARRAY, expecting ')' in /in/kSWZJ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/kSWZJ on line 3
Process exited with code 255.

preferences:
215.91 ms | 401 KiB | 325 Q