3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php ini_set("display_errors","On"); error_reporting(E_ALL); function without($var){ echo "Certain death\n"; $var.='die fucker DIE! ajajajajajajjjkajklsdjklasjdklasd'; echo memory_get_usage(), PHP_EOL; } function with(&$var){ echo "Alive\n"; echo memory_get_usage(), PHP_EOL; $var.="FUCK!"; } $str = str_repeat('foo', 10000000); echo memory_get_usage(), PHP_EOL; echo "END\n"; with($str); without($str);
based on TS415
Output for 7.1.0
30351552 END Alive 30351608 Certain death 60354832
Output for 7.0.0 - 7.0.14
30351592 END Alive 30351648 Certain death 60354872
Output for hhvm-3.10.0 - 3.13.2
2097152 END Alive 2097152 Certain death 2097152
Output for 5.6.0 - 5.6.28
30220536 END Alive 30220616 Certain death 60220792
Output for 5.5.0 - 5.5.38
30220536 END Alive 30220600 Certain death 60220752
Output for 5.4.0 - 5.4.45
30221056 END Alive 30221120 Certain death 60221272
Output for 5.3.11 - 5.3.29
30624416 END Alive 30624448 Certain death 60624568
Output for 5.3.0 - 5.3.10
30624280 END Alive 30624312 Certain death 60624432
Output for 5.2.10 - 5.2.17
30082968 END Alive 30083264 Certain death 60083376
Output for 5.2.7 - 5.2.9
30083600 END Alive 30083904 Certain death 60084072
Output for 5.2.3 - 5.2.6
30083752 END Alive 30084056 Certain death 60084224
Output for 5.2.2
30081680 END Alive 30081944 Certain death 60082112
Output for 5.2.1
30081728 END Alive 30081992 Certain death 60082064
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/3JRHf on line 20
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/3JRHf on line 20
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/3JRHf on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.1