3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $arr = array("test"); function bar( $str ){ $val = $this->arr[0]; var_dump($val); if ( is_callable( self::$val ) ){ self::{$this->arr[0]}( $str ); } } static function test($var) { echo "Testing: $var\n"; } } (new Foo)->bar("bla");
based on 1mn3S
Output for 7.0.0 - 7.2.0
string(4) "test" Fatal error: Uncaught Error: Access to undeclared static property: Foo::$val in /in/u0orS:9 Stack trace: #0 /in/u0orS(20): Foo->bar('bla') #1 {main} thrown in /in/u0orS on line 9
Process exited with code 255.
Output for 5.4.12 - 5.6.28
string(4) "test" Fatal error: Access to undeclared static property: Foo::$val in /in/u0orS on line 9
Process exited with code 255.
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '{', expecting T_STRING or T_VARIABLE or '$' in /in/u0orS on line 10
Process exited with code 255.