3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Kitchen { private $yummy = 'cake'; } $kitchen = new Kitchen(); (Closure::bind(function (Kitchen $kitchen) { $kitchen->yummy = 'pasta'; return $kitchen; }, null))($kitchen); var_dump($kitchen);
based on BlUXn
Output for 7.0.0 - 7.3.0alpha1
Fatal error: Uncaught Error: Cannot access private property Kitchen::$yummy in /in/UbhqU:12 Stack trace: #0 /in/UbhqU(15): {closure}(Object(Kitchen)) #1 {main} thrown in /in/UbhqU on line 12
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Cannot access protected property in /in/UbhqU:12 Stack trace: #0 /in/UbhqU(15): Closure$() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '(' in /in/UbhqU on line 15
Process exited with code 255.