3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { var $i = 0; } class B extends A { var $i = 150; } $a = new A(); $b = new B(); echo '$a->i: ', $a->i, "\n"; // 0 echo '$b->i: ', $b->i, "\n"; // 150 $a->i = 100; echo '$b->i: ', $b->i, "\n"; //150 echo '$a->i: ', $a->i, "\n"; // 100 $b->i = 50; // Ne modifie pas la propriété $i de A echo '$a->i: ', $a->i, "\n"; //100 echo '$b->i: ', $b->i, "\n"; // 50
Output for git.master, git.master_jit, rfc.property-hooks
$a->i: 0 $b->i: 150 $b->i: 150 $a->i: 100 $a->i: 100 $b->i: 50

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