3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Something { public function __construct() { $this->current_user = Auth::get_user(); } public function another_thing() { $groups = array_filter(array(0, 1, 5, 10, 50), function($item) { return $item < $this->current_user->group; }); } } Something::another_thing();
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method Something::another_thing() should not be called statically in /in/uhRZi on line 18 Fatal error: Uncaught Error: Using $this when not in object context in /in/uhRZi:13 Stack trace: #0 [internal function]: Something::{closure}(0) #1 /in/uhRZi(14): array_filter(Array, Object(Closure)) #2 /in/uhRZi(18): Something::another_thing() #3 {main} thrown in /in/uhRZi on line 13
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Strict Standards: Non-static method Something::another_thing() should not be called statically in /in/uhRZi on line 18 Fatal error: Using $this when not in object context in /in/uhRZi on line 13
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/uhRZi on line 12
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/uhRZi on line 12
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/uhRZi on line 5
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/uhRZi on line 5
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/uhRZi on line 5
Process exited with code 255.