3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Bar { public function Baz($uri) { $uri = parse_url($uri); array_walk( $uri, function($value, $name) { $this->$component = $value; } ); } } $bar = new Bar(); $bar->Baz('http://foo.bar/test?q=v'); var_dump($bar);
based on bEACg
Output for 7.1.0
Notice: Undefined variable: component in /in/Grslh on line 9 Notice: Undefined variable: component in /in/Grslh on line 9 Notice: Undefined variable: component in /in/Grslh on line 9 Notice: Undefined variable: component in /in/Grslh on line 9 object(Bar)#1 (1) { [""]=> string(3) "q=v" }
Output for 7.0.0 - 7.0.14
Notice: Undefined variable: component in /in/Grslh on line 9 Fatal error: Uncaught Error: Cannot access empty property in /in/Grslh:9 Stack trace: #0 [internal function]: Bar->{closure}('http', 'scheme') #1 /in/Grslh(9): array_walk(Array, Object(Closure)) #2 /in/Grslh(16): Bar->Baz(Array) #3 {main} thrown in /in/Grslh on line 9
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Notice: Undefined variable: component in /in/Grslh on line 9 Fatal error: Cannot access empty property in /in/Grslh on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Using $this when not in object context in /in/Grslh on line 9
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/Grslh on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/Grslh on line 9
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/Grslh on line 4
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/Grslh on line 4
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/Grslh on line 4
Process exited with code 255.