3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function myfunction($array){ echo PHP_EOL . 'pass $array to function...' . PHP_EOL; var_dump(memory_get_usage()); echo PHP_EOL . 'modify $array...' . PHP_EOL; $array[343] = 23; var_dump(memory_get_usage()); } function myfunction_passbyref(&$array){ echo PHP_EOL . 'pass-by-ref $array to function...' . PHP_EOL; var_dump(memory_get_usage()); echo PHP_EOL . 'modify $array...' . PHP_EOL; $array[343] = 23; var_dump(memory_get_usage()); } echo PHP_EOL . 'init $array with 10k elements...' . PHP_EOL; $array = range(1,10000); var_dump(memory_get_usage()); myfunction($array); myfunction_passbyref($array);
Output for 7.0.0 - 7.1.0
init $array with 10k elements... int(877152) pass $array to function... int(877152) modify $array... int(1405592) pass-by-ref $array to function... int(877176) modify $array... int(877176)
Output for hhvm-3.10.0 - 3.12.0
init $array with 10k elements... int(2097152) pass $array to function... int(2097152) modify $array... int(2097152) pass-by-ref $array to function... int(2097152) modify $array... int(2097152)
Output for 5.6.7 - 5.6.21
init $array with 10k elements... int(1712664) pass $array to function... int(1712712) modify $array... int(2723984) pass-by-ref $array to function... int(1712760) modify $array... int(1712760)
Output for 5.5.24 - 5.5.35
init $array with 10k elements... int(1712648) pass $array to function... int(1712696) modify $array... int(2723968) pass-by-ref $array to function... int(1712744) modify $array... int(1712744)
Output for 5.4.10 - 5.4.45
init $array with 10k elements... int(1713144) pass $array to function... int(1713192) modify $array... int(2724464) pass-by-ref $array to function... int(1713240) modify $array... int(1713240)
Output for 5.4.0 - 5.4.9
init $array with 10k elements... int(1713160) pass $array to function... int(1713208) modify $array... int(2724480) pass-by-ref $array to function... int(1713256) modify $array... int(1713256)
Output for 5.3.11 - 5.3.29
init $array with 10k elements... int(2117584) pass $array to function... int(2117584) modify $array... int(3128864) pass-by-ref $array to function... int(2117584) modify $array... int(2117584)
Output for 5.3.0 - 5.3.10
init $array with 10k elements... int(2117272) pass $array to function... int(2117272) modify $array... int(3128560) pass-by-ref $array to function... int(2117272) modify $array... int(2117272)
Output for 5.2.10 - 5.2.17
init $array with 10k elements... int(1496736) pass $array to function... int(1497000) modify $array... int(2508264) pass-by-ref $array to function... int(1497000) modify $array... int(1497000)
Output for 5.2.7 - 5.2.9
init $array with 10k elements... int(1498608) pass $array to function... int(1498888) modify $array... int(2510208) pass-by-ref $array to function... int(1628080) modify $array... int(1628136)
Output for 5.2.3 - 5.2.6
init $array with 10k elements... int(1498912) pass $array to function... int(1499192) modify $array... int(2510512) pass-by-ref $array to function... int(1628392) modify $array... int(1628424)
Output for 5.2.2
init $array with 10k elements... int(1496816) pass $array to function... int(1497096) modify $array... int(2508416) pass-by-ref $array to function... int(1626288) modify $array... int(1626344)
Output for 5.2.1
init $array with 10k elements... int(1496336) pass $array to function... int(1496568) modify $array... int(2507888) pass-by-ref $array to function... int(1527992) modify $array... int(1528016)
Output for 5.0.2 - 5.2.0
init $array with 10k elements... Fatal error: Call to undefined function memory_get_usage() in /in/0cd53 on line 22
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function memory_get_usage() in /in/0cd53 on line 22
Process exited with code 255.
Output for 4.4.5 - 4.4.9
init $array with 10k elements... Fatal error: Call to undefined function: memory_get_usage() in /in/0cd53 on line 22
Process exited with code 255.
Output for 4.3.10 - 4.4.4
init $array with 10k elements... Fatal error: Call to undefined function: memory_get_usage() in /in/0cd53 on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.9
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function: memory_get_usage() in /in/0cd53 on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/0cd53 on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function: memory_get_usage() in /in/0cd53 on line 22