3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function test(&$arr) { static $i; var_dump(self::$i); if (!isset(self::$i)) { self::$i = &$arr[0]; } } } $arr = [1, 2, 3]; $a = new A(); $a->test($arr); $a->test($arr);
based on 0LSc9
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Access to undeclared static property: A::$i in /in/q1c35:7 Stack trace: #0 /in/q1c35(17): A->test(Array) #1 {main} thrown in /in/q1c35 on line 7
Process exited with code 255.
Output for 5.4.12 - 5.6.28
Fatal error: Access to undeclared static property: A::$i in /in/q1c35 on line 7
Process exited with code 255.
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/q1c35 on line 14
Process exited with code 255.