3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class x { function t($func) { if (is_array($func) && $func[0] = 'this') $this->$func[1](); } function test() { print 'test'; } } $func = ['this', 'test']; (new x)->t($func);
Output for 7.0.0 - 7.2.0
Notice: Array to string conversion in /in/ZosuL on line 8 Notice: Undefined property: x::$Array in /in/ZosuL on line 8 Fatal error: Uncaught Error: Function name must be a string in /in/ZosuL:8 Stack trace: #0 /in/ZosuL(18): x->t(Array) #1 {main} thrown in /in/ZosuL on line 8
Process exited with code 255.
Output for 5.4.11 - 5.6.28
test
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ZosuL on line 17
Process exited with code 255.