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"; echo 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 XTbbg
Output for 7.0.0 - 7.2.0
bar Fatal error: Uncaught Error: Undefined class constant 'cat' in /in/VmuHX:11 Stack trace: #0 /in/VmuHX(17): Test::foo() #1 /in/VmuHX(30): Test->bar() #2 {main} thrown in /in/VmuHX on line 11
Process exited with code 255.
Output for 5.5.0 - 5.6.28
bar Fatal error: Undefined class constant 'cat' in /in/VmuHX on line 11
Process exited with code 255.