3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($var) { echo "in function ",__FUNCTION__,"\n"; echo "Test: \$var == $var\n"; } class foo { $arr = array("test"); static function hello(){ echo "hi\n"; } function bar() { $this->arr[0]('some value'); } } $a = new foo(); $a->bar(); foo::hello(); var_dump(method_exists($a,'test')); var_dump(method_exists('foo','hello'));
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17, 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '$arr' (T_VARIABLE), expecting function (T_FUNCTION) in /in/Gv8j9 on line 10
Process exited with code 255.

preferences:
199.35 ms | 1395 KiB | 28 Q