3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function t35_handler_MOO($no, $msg){ echo __LINE__.__METHOD__."\n"; restore_error_handler(); echo __LINE__.__METHOD__."\n"; } function t35_handler($no, $msg){ echo __LINE__.__METHOD__."\n"; restore_error_handler(); echo __LINE__.__METHOD__."\n"; } function t35(){ set_error_handler("t35_handler_MOO"); 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.5 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
old handler=t35_handler_MOO 10t35_handler 12t35_handler old handler=t35_handler_MOO 10t35_handler 12t35_handler
Output for 5.0.0 - 5.0.4
old handler=t35_handler_MOO 10t35_handler 12t35_handler old handler=t35_handler 10t35_handler 12t35_handler
Output for 4.4.0 - 4.4.9
old handler=t35_handler_MOO Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 10 10__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 6 6__METHOD__ 12__METHOD__ old handler=t35_handler_MOO Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 10 10__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 6 6__METHOD__ 12__METHOD__
Output for 4.3.0 - 4.3.11
old handler=t35_handler_MOO Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 10 10__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 4 4__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 6 6__METHOD__ 12__METHOD__ old handler=t35_handler Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 10 10__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 10 10__METHOD__ Notice: Use of undefined constant __METHOD__ - assumed '__METHOD__' in /in/ZNEMF on line 12 12__METHOD__ 12__METHOD__