fork download
  1. <?php
  2. class teste {
  3. public $nome = "João";
  4. }
  5. $retorno = array( 'nome' => 'João');
  6. echo $retorno->nome;
  7. echo "---\n";
  8. echo $retorno['nome'];
  9. echo "\n---\n";
  10. $retorno = new teste();
  11. echo $retorno->nome;
  12. //echo $retorno['nome'];
  13.  
  14. //https://pt.stackoverflow.com/q/568329/101
Success #stdin #stdout #stderr 0.02s 26304KB
stdin
Standard input is empty
stdout
---
João
---
João
stderr
PHP Notice:  Trying to get property 'nome' of non-object in /home/YQqtfc/prog.php on line 6