3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler( function($error_num, $message, $file_name, $line_num) { $trace = debug_backtrace(); foreach($trace as $trace_row){ array_walk_recursive($trace, function(&$val, $index){ $max_length = 100; //The strlen(...) function has to be passed a string value, so convert objects to their respective class names - otherwise an error will be thrown if ( is_object($val) ) { $val = get_class($val); } $length = strlen($val); if( $length > $max_length ){ $val = substr($val, 0, $max_length) . "...(original length $length)"; } }); } return true; } ); class A{ function do_stuff(&$b) { var_dump('Before in function:', $b); $defined = 0; #trigger_error("If I fixed the undefined variable but enabled this line instead, it will also turn b from an object into a string! So user-triggered notices bork it as well."); $x = $undefined || $defined ? 14 : 0; var_dump('After in function:', $b); } } class B{} $a = new A(); $b = new B(); $a->do_stuff($b); var_dump('After function:', $b); ?>
Output for git.master, git.master_jit, rfc.property-hooks
string(19) "Before in function:" object(B)#3 (0) { } string(18) "After in function:" object(B)#3 (0) { } string(15) "After function:" object(B)#3 (0) { }

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