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_passbyref($array); myfunction($array);
Output for 7.0.0 - 7.1.0
init $array with 10k elements... int(877152) pass-by-ref $array to function... int(877176) modify $array... int(877176) pass $array to function... int(877176) modify $array... int(1405616)
Output for 5.6.0 - 5.6.28
init $array with 10k elements... int(1712664) pass-by-ref $array to function... int(1712712) modify $array... int(1712712) pass $array to function... int(1712760) modify $array... int(2724032)
Output for 5.5.0 - 5.5.36
init $array with 10k elements... int(1712648) pass-by-ref $array to function... int(1712696) modify $array... int(1712696) pass $array to function... int(1712744) modify $array... int(2724016)
Output for 5.4.10 - 5.4.45
init $array with 10k elements... int(1713144) pass-by-ref $array to function... int(1713192) modify $array... int(1713192) pass $array to function... int(1713240) modify $array... int(2724512)
Output for 5.4.0 - 5.4.9
init $array with 10k elements... int(1713160) pass-by-ref $array to function... int(1713208) modify $array... int(1713208) pass $array to function... int(1713256) modify $array... int(2724528)
Output for 5.3.11 - 5.3.29
init $array with 10k elements... int(2117584) pass-by-ref $array to function... int(2117584) modify $array... int(2117584) pass $array to function... int(2117584) modify $array... int(3128864)
Output for 5.3.0 - 5.3.10
init $array with 10k elements... int(2117272) pass-by-ref $array to function... int(2117272) modify $array... int(2117272) pass $array to function... int(2117272) modify $array... int(3128560)
Output for 5.2.10 - 5.2.17
init $array with 10k elements... int(1496736) pass-by-ref $array to function... int(1497000) modify $array... int(1497000) pass $array to function... int(1497000) modify $array... int(2508264)
Output for 5.2.7 - 5.2.9
init $array with 10k elements... int(1498608) pass-by-ref $array to function... int(1498792) modify $array... int(1498888) pass $array to function... int(1498984) modify $array... int(2510208)
Output for 5.2.3 - 5.2.6
init $array with 10k elements... int(1498912) pass-by-ref $array to function... int(1499096) modify $array... int(1499192) pass $array to function... int(1499288) modify $array... int(2510512)
Output for 5.2.2
init $array with 10k elements... int(1496816) pass-by-ref $array to function... int(1497000) modify $array... int(1497096) pass $array to function... int(1497192) modify $array... int(2508416)
Output for 5.2.1
init $array with 10k elements... int(1496368) pass-by-ref $array to function... int(1496552) modify $array... int(1496648) pass $array to function... int(1496744) modify $array... int(2507960)
Output for 5.0.2 - 5.2.0
init $array with 10k elements... Fatal error: Call to undefined function memory_get_usage() in /in/uhrDt 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/uhrDt on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/uhrDt on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function memory_get_usage() in /in/uhrDt 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/uhrDt 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/uhrDt 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/uhrDt on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/uhrDt on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function: memory_get_usage() in /in/uhrDt 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/uhrDt on line 20 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/uhrDt on line 20 PHP_EOLinit $array with 10k elements...PHP_EOL Fatal error: Call to undefined function: memory_get_usage() in /in/uhrDt on line 22