3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { private $baz = 1; private $cat = 'abc'; public static function foo() { // echo "foo\n"; return self::cat; } public function bar() { echo "bar\n"; $this->foo(); $this::foo(); self::foo(); self::baz(); } public function baz() { printf("baz = %d\n", $this->baz); } } $test = new Test; $test->bar();
based on b6IRq
Output for 7.0.0 - 7.2.0
bar Fatal error: Uncaught Error: Undefined class constant 'cat' in /in/XTbbg:11 Stack trace: #0 /in/XTbbg(17): Test::foo() #1 /in/XTbbg(30): Test->bar() #2 {main} thrown in /in/XTbbg on line 11
Process exited with code 255.
Output for 5.3.19 - 5.6.28
bar Fatal error: Undefined class constant 'cat' in /in/XTbbg on line 11
Process exited with code 255.