3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class LOL{ const FOO = 1; } $x = new LOL; $arr = array('x' => $x); echo $x::FOO; // works echo $arr['x']::FOO; // works too class WWW{ protected $lol; public function __construct($lol){ $this->lol= $lol; } public function doSMth(){ $lol = $this->lol; echo $lol::FOO; // fail. parse error.. wtf } } $w = new WWW; $w->doSMth();
Output for 7.1.0
11 Fatal error: Uncaught ArgumentCountError: Too few arguments to function WWW::__construct(), 0 passed in /in/JvAJG on line 27 and exactly 1 expected in /in/JvAJG:17 Stack trace: #0 /in/JvAJG(27): WWW->__construct() #1 {main} thrown in /in/JvAJG on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.14
11 Warning: Missing argument 1 for WWW::__construct(), called in /in/JvAJG on line 27 and defined in /in/JvAJG on line 17 Notice: Undefined variable: lol in /in/JvAJG on line 18 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/JvAJG:23 Stack trace: #0 /in/JvAJG(28): WWW->doSMth() #1 {main} thrown in /in/JvAJG on line 23
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
11 Warning: __construct() expects exactly 1 parameter, 0 given in /in/JvAJG on line 18 Notice: Undefined variable: lol in /in/JvAJG on line 18 Fatal error: Cls: Expected string or object in /in/JvAJG on line 23
Process exited with code 255.
Output for 5.3.0 - 5.6.21
11 Warning: Missing argument 1 for WWW::__construct(), called in /in/JvAJG on line 27 and defined in /in/JvAJG on line 17 Notice: Undefined variable: lol in /in/JvAJG on line 18 Fatal error: Class name must be a valid object or a string in /in/JvAJG on line 23
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /in/JvAJG on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ',' or ';' in /in/JvAJG on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/JvAJG 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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/JvAJG 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/JvAJG on line 4
Process exited with code 255.