3v4l.org

run code in 200+ php & hhvm versions
<?php function inspect($object, $property) { return (function () use ($property) { return $this->$property; })->call($object); } class Foo { private $bar = "hands off!"; } var_dump(inspect(new Foo(), "bar"));

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(10) "hands off!"
Output for branch php-master+opcache
string(10) "hands off!"
Output for branch php-master+jit
string(10) "hands off!"
Output for Typed properties v2
string(10) "hands off!"
Output for Arrow functions
string(10) "hands off!"
Output for Object typehint
string(10) "hands off!"
Output for Array change keys
string(10) "hands off!"
Output for Lexical anon
string(10) "hands off!"

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