3v4l.org

run code in 200+ PHP versions simultaneously
<?php 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); ?>

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
string(19) "Before in function:" object(B)#2 (0) { } Warning: Undefined variable: undefined in /in/fZij6 on line 7 string(18) "After in function:" object(B)#2 (0) { } string(15) "After function:" object(B)#2 (0) { }
Output for branch php-master+jit
string(19) "Before in function:" object(B)#2 (0) { } Warning: Undefined variable: undefined in /in/fZij6 on line 7 string(18) "After in function:" object(B)#2 (0) { } string(15) "After function:" object(B)#2 (0) { }
Output for branch php-master+opcache
string(19) "Before in function:" object(B)#2 (0) { } Warning: Undefined variable: undefined in /in/fZij6 on line 7 string(18) "After in function:" object(B)#2 (0) { } string(15) "After function:" object(B)#2 (0) { }

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