3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $a; public function test() { try { echo 'doo stuff'; $this->a = 1; return 1; } catch (Exception $e) { $this->a = 2; throw $e; } finally { $this->a = 3; } } } $foo = new Foo(); $foo->test(); var_dump($foo->a);
based on G6JKd
Output for 7.0.0 - 7.2.0
doo stuff Fatal error: Uncaught Error: Cannot access private property Foo::$a in /in/CDgZH:21 Stack trace: #0 {main} thrown in /in/CDgZH on line 21
Process exited with code 255.
Output for 5.5.24 - 5.6.28
doo stuff Fatal error: Cannot access private property Foo::$a in /in/CDgZH on line 21
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Parse error: syntax error, unexpected '{' in /in/CDgZH on line 13
Process exited with code 255.