3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Hoge { protected $a = 'maa'; private $b = 2; } class TestHoge extends Hoge { public $a; public $b; public static function __set_state($an_array) { $obj = new Hoge; $obj->a = $an_array['a']; $obj->b = $an_array['b']; return $obj; } } $c = eval(var_export(new TestHoge, true).';'); print_r($c);
based on Ngk0v
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot access private property Hoge::$b in /in/uigbJ:17 Stack trace: #0 /in/uigbJ(22) : eval()'d code(2): TestHoge::__set_state(Array) #1 /in/uigbJ(22): eval() #2 {main} thrown in /in/uigbJ on line 17
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Cannot access private property Hoge::$b in /in/uigbJ on line 17
Process exited with code 255.