3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { function returnArray(){ return [0,1]; } function returnThis(){ return $this; } } $obj = new foo(); var_dump(isset($obj->returnThis()->returnArray()[1]));
based on ie4Fd
Output for 7.0.0 - 7.2.0
bool(true)
Output for 5.5.24 - 5.6.28
Fatal error: Cannot use isset() on the result of a function call (you can use "null !== func()" instead) in /in/maG43 on line 14
Process exited with code 255.
Output for 5.4.9 - 5.4.45
Fatal error: Can't use method return value in write context in /in/maG43 on line 14
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/maG43 on line 4
Process exited with code 255.