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"));
Output for 7.0.0 - 7.4.0beta2
string(10) "hands off!"
Output for hhvm-3.22.0
Fatal error: Uncaught Error: syntax error, unexpected T_OBJECT_OPERATOR in /in/lqZBd:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.3
Fatal error: Uncaught Error: syntax error, unexpected T_OBJECT_OPERATOR in /in/lqZBd:6 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: syntax error, unexpected T_OBJECT_OPERATOR in /in/lqZBd on line 6
Process exited with code 255.
Output for 5.4.0 - 5.6.40
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/lqZBd on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/lqZBd on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/lqZBd on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/lqZBd on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/lqZBd on line 4
Process exited with code 255.