3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class User { private $nome; public $email; protected $senha; /* public function __construct($senha){ $this->senha = $senha; } */ } class User2 extends User { private $login; /* public function __construct($senha, $login){ parent::__construct($senha); $this->login = $login; } public function get_login(){ return $this->login; } public function get_senha(){ return $this->senha; } public function get_nome(){ return parent::$this->nome; } public function set_nome($nome){ parent::$this->nome = $nome; } */ } $usuario = new User2(); $usuario->nome = 'Isael'; $usuario->email = 'isael2email.com'; echo $usuario->nome.'<br />'; echo $usuario->email; print_r($usuario);
Output for 5.3.0 - 7.1.0
Isael<br />isael2email.comUser2 Object ( [login:User2:private] => [nome:User:private] => [email] => isael2email.com [senha:protected] => [nome] => Isael )
Output for 5.0.0 - 5.2.17
Isael<br />isael2email.comUser2 Object ( [login:private] => [nome:private] => [email] => isael2email.com [senha:protected] => [nome] => Isael )
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/uSFk7 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/uSFk7 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/uSFk7 on line 5
Process exited with code 255.