3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { var $arr = array("test"); function test($var) { echo "Test $var"; } } $a = new foo(); echo "<PRE>"; var_dump($a); echo "</PRE>"; $a->arr[0]("testvalue"); ?>
Output for 7.0.0 - 7.2.0
<PRE>object(foo)#1 (1) { ["arr"]=> array(1) { [0]=> string(4) "test" } } </PRE> Fatal error: Uncaught Error: Call to undefined function test() in /in/ZI8Vl:16 Stack trace: #0 {main} thrown in /in/ZI8Vl on line 16
Process exited with code 255.
Output for 5.3.21 - 5.6.28
<PRE>object(foo)#1 (1) { ["arr"]=> array(1) { [0]=> string(4) "test" } } </PRE> Fatal error: Call to undefined function test() in /in/ZI8Vl on line 16
Process exited with code 255.