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 // ... set_error_handler($this); 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 Fatal error: Uncaught Error: Using $this when not in object context in /in/5UstZ:16 Stack trace: #0 [internal function]: {closure}(1024, 'Some message', '/in/5UstZ', 23) #1 /in/5UstZ(23): trigger_error('Some message', 1024) #2 {main} thrown in /in/5UstZ on line 16
Process exited with code 255.

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:
53.08 ms | 401 KiB | 8 Q