3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $test = new Test; print_r($test->method()); class Test { public $holder; public static function method() { $this->holder[0] = array('one' => 'item'); return $this->holder; } }
Output for 7.0.0 - 7.3.0rc4
Fatal error: Uncaught Error: Using $this when not in object context in /in/tUihp:14 Stack trace: #0 /in/tUihp(5): Test::method() #1 {main} thrown in /in/tUihp on line 14
Process exited with code 255.
Output for hhvm-3.11.1 - 3.17.3
Fatal error: Uncaught Error: $this is null in /in/tUihp:14 Stack trace: #0 /in/tUihp(5): Test::method() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.1
Fatal error: $this is null in /in/tUihp on line 14
Process exited with code 255.
Output for 5.0.0 - 5.6.30
Fatal error: Using $this when not in object context in /in/tUihp on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tUihp on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/tUihp on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/tUihp on line 9
Process exited with code 255.