3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test($var) { echo "Test $var"; } class foo { var $arr = array("test"); /*function test($var) { echo "Test $var"; }*/ } class moo { static public $arr = array("test"); /*function test($var) { echo "Test $var"; }*/ } $a = new foo(); var_dump($a);; $a->arr[0]("testvalue"); moo::$arr[0]("another one"); ?>
based on NQrlW
Output for 7.0.0 - 7.2.0
object(foo)#1 (1) { ["arr"]=> array(1) { [0]=> string(4) "test" } } Test testvalueTest another one
Output for 5.5.0 - 5.6.28
object(foo)#1 (1) { ["arr"]=> array(1) { [0]=> string(4) "test" } } Test testvalue Notice: Undefined variable: arr in /in/9kvM5 on line 36 Fatal error: Function name must be a string in /in/9kvM5 on line 36
Process exited with code 255.