run code in 200+ php & hhvm versions
Bugs & Features
<?php function onDie(){ $message = ob_get_contents(); //Capture 'Doh' ob_end_clean(); //Cleans output buffer echo 'ondie'.$message; //callWhateverYouWhant(); } register_shutdown_function('onDie'); //... ob_start(); //You need this to Turn on output buffering before using die/exit @$dumbVar = 1000/0 or die('Doh'); //"@" prevent warning/error from php //... ob_end_clean(); //Remember clean your buffer before you need to use echo/print
based on MdJYD
Output for 7.0.0 - 7.3.1
Notice: ob_end_clean(): failed to delete buffer. No buffer to delete in /in/drQVE on line 5 ondie
Output for 5.3.19 - 5.6.21