3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar; function __construct() { $bar = "bar"; } function bar() { return $bar; } } $foo = new Foo(); echo $foo->bar;
based on cY6PC
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access private property Foo::$bar in /in/eEOGP:18 Stack trace: #0 {main} thrown in /in/eEOGP on line 18
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Fatal error: Cannot access private property Foo::$bar in /in/eEOGP on line 18
Process exited with code 255.