3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set("display_errors","On"); error_reporting(E_ALL); function without($var){ echo "Certain death\n"; $var.='die fucker DIE!'; echo memory_get_usage(), PHP_EOL; } function with(&$var){ echo "Alive\n"; echo memory_get_usage(), PHP_EOL; } $str = str_repeat('foo', 100000); echo memory_get_usage(), PHP_EOL; echo "END\n"; with($str); without($str);
Output for 7.2.0
687984 END Alive 688040 Certain death 991144
Output for 7.1.0, 7.1.7
651312 END Alive 651368 Certain death 954472
Output for 7.1.5 - 7.1.6
651584 END Alive 651640 Certain death 954744
Output for 7.0.0 - 7.0.20
651352 END Alive 651408 Certain death 954512
Output for 5.6.0 - 5.6.28
520464 END Alive 520544 Certain death 820656
Output for 5.5.0 - 5.5.38
520464 END Alive 520528 Certain death 820640
Output for 5.4.0 - 5.4.45
520984 END Alive 521048 Certain death 821160
Output for 5.3.11 - 5.3.29
924224 END Alive 924256 Certain death 1224336
Output for 5.3.0 - 5.3.10
924088 END Alive 924120 Certain death 1224200
Output for 5.2.10 - 5.2.17
382776 END Alive 383072 Certain death 683144
Output for 5.2.7 - 5.2.9
383408 END Alive 383712 Certain death 683840
Output for 5.2.3 - 5.2.6
383560 END Alive 383864 Certain death 683992
Output for 5.2.2
381488 END Alive 381752 Certain death 681880
Output for 5.2.1
381536 END Alive 381800 Certain death 681832
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/HWkW4 on line 19
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: memory_get_usage() in /in/HWkW4 on line 19
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: memory_get_usage() in /in/HWkW4 on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.1

preferences:
189.44 ms | 401 KiB | 218 Q