fork(3) download
  1. <?php
  2.  
  3. class Funcionario{
  4. public $nome = 'Alex';
  5. protected $salario = 200;
  6. private $rg ='00.000.000-0';
  7. }
  8.  
  9. $funcionario = new Funcionario;
  10. echo $funcionario->nome;
  11. echo $funcionario->salario;
  12. echo $funcionario->rg;
Runtime error #stdin #stdout #stderr 0.01s 82880KB
stdin
Standard input is empty
stdout
Alex
stderr
PHP Fatal error:  Uncaught Error: Cannot access protected property Funcionario::$salario in /home/JdH6Vx/prog.php:11
Stack trace:
#0 {main}
  thrown in /home/JdH6Vx/prog.php on line 11