3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class ToolbarItem { CONST TYPE_BUTTON = 1; CONST TYPE_LINK = 2; protected $label; protected $icon; protected $attributes = array(); protected $type = self::TYPE_BUTTON; public function __construct($label) { } public function setIcon() { } public function setAttr() { } public function setType($type = self::TYPE_BUTTON) { } public function getType() { return $this->type; } } $item = new ToolbarItem('Label'); echo $Item->getType();
Output for 7.0.5 - 7.1.0
Notice: Undefined variable: Item in /in/pY75g on line 41 Fatal error: Uncaught Error: Call to a member function getType() on null in /in/pY75g:41 Stack trace: #0 {main} thrown in /in/pY75g on line 41
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: Item in /in/pY75g on line 41 Fatal error: Uncaught Error: Call to a member function getType() on unknown in /in/pY75g:41 Stack trace: #0 {main} thrown in /in/pY75g on line 41
Process exited with code 255.
Output for 5.6.0 - 5.6.28
Notice: Undefined variable: Item in /in/pY75g on line 41 Fatal error: Call to a member function getType() on null in /in/pY75g on line 41
Process exited with code 255.
Output for 5.0.5 - 5.5.37
Notice: Undefined variable: Item in /in/pY75g on line 41 Fatal error: Call to a member function getType() on a non-object in /in/pY75g on line 41
Process exited with code 255.
Output for 5.0.0 - 5.0.4
Fatal error: Cannot access self:: when no class scope is active in /in/pY75g on line 39
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/pY75g 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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/pY75g 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/pY75g on line 5
Process exited with code 255.