3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function t35_handler($no, $msg){ echo __LINE__.__METHOD__."\n"; restore_error_handler(); echo __LINE__.__METHOD__."\n"; } function t35(){ echo "old handler=".set_error_handler("t35_handler")."\n"; trigger_error("error1"); echo "old handler=".set_error_handler("t35_handler")."\n"; trigger_error("error2"); } t35(); ?>
Output for 5.0.0 - 7.1.0
old handler= 4t35_handler 6t35_handler old handler=t35_handler 4t35_handler 6t35_handler
Output for 4.3.0 - 4.4.9
old handler= Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/JC4kH on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/JC4kH on line 6 6__METHOD__ old handler=t35_handler Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/JC4kH on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/JC4kH on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/JC4kH on line 6 6__METHOD__ 6__METHOD__