3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $x; } function id_from_prop(object $obj, string $prop) { $id = (ReflectionReference::fromArrayElement((array) $obj, $prop))?->getId(); return $id ? bin2hex($id) : null; } $foo = new Foo(); $x = 42; $foo->x = &$x; var_dump(id_from_prop($foo, 'x')); var_dump(id_from_prop($foo, 'x')); $y = &$z; var_dump(id_from_prop($foo, 'x'));
Output for git.master_jit
string(40) "9890496b3bcbe6fff4e7991bd65c7aa9f996a66d" string(40) "9890496b3bcbe6fff4e7991bd65c7aa9f996a66d" string(40) "9890496b3bcbe6fff4e7991bd65c7aa9f996a66d"
Output for git.master
string(40) "d68876dc969467a41e0e30b320f0c7d32d3b1e6d" string(40) "d68876dc969467a41e0e30b320f0c7d32d3b1e6d" string(40) "d68876dc969467a41e0e30b320f0c7d32d3b1e6d"

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.59 ms | 406 KiB | 5 Q