3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar = 'baz'; protected $baz = 'bar'; public function modify(){ $this->bar = 'bar'; $this->baz = 'baz'; } public function peek($target){ print "\n".'Bar: '.$target->bar; print "\n".'Baz: '.$target->baz; } public function strangerDanger($target){ $target->bar = 'baz1'; $target->baz = 'bar1'; } } $first = new Foo(); $second = new Foo(); $first->modify(); $second->peek($first); $second->strangerDanger($first); $second->peek($first);
based on dqWdI
Output for 5.0.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Bar: bar Baz: baz Bar: baz1 Baz: bar1
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/hBM21 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/hBM21 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/hBM21 on line 4
Process exited with code 255.