3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected static $array = ['a', 'b', 'c']; protected static function getArray() { return $array; } public static function test($testArray) { return array_key_intersect($testArray, array_flip(self::getArray())); } } print_r(Test::test(['a' => 2]));
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.29, 5.6.8 - 5.6.13
Fatal error: Constructor Test::test() cannot be static in /in/eVFdc on line 12
Process exited with code 255.

preferences:
79.9 ms | 402 KiB | 62 Q