3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { public int $i; } $array = [new x, new x, new x]; $array[0]->i = 0; $array[1]->i = 1; $array[2]->i = 2; function foo(array $array) { $array[] = new x; $array[2]->i = 12; $array[3]->i = 3; print count($array)." elements in foo\n"; } print count($array)." elements before foo\n"; foo($array); print count($array)." elements after foo\n"; print_r($array[2]);
Output for rfc.property-hooks, git.master, git.master_jit
3 elements before foo 4 elements in foo 3 elements after foo X Object ( [i] => 12 )

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.29 ms | 2756 KiB | 4 Q