3v4l.org

run code in 300+ PHP versions simultaneously
<?php $error_handler = function($level,$message) { echo "Main error handler: $message \n"; // ... // imagine somewhere inside the error handler a log writer is called // which uses it's own error handler for failing file operations // which is what Zend\Log\Writer\Stream does with Zend\StdLib\ErrorHandler $nested_error_handler = function ($level,$message) { echo "Nested error handler: $message \n"; }; set_error_handler($nested_error_handler,E_WARNING); //strpos(); //Produce a warning inside the log writer restore_error_handler(); //restore the error handler to $eh after log written // ... return true; }; set_error_handler($error_handler); trigger_error('Some message',E_USER_NOTICE); /* expected output: Main error handler: Some message */ trigger_error('Some other message',E_USER_NOTICE); /* expected output: Main error handler: Some other message */
Output for git.master, git.master_jit, rfc.property-hooks
Main error handler: Some message Main error handler: Some other message

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
64.35 ms | 401 KiB | 8 Q