Advertisement
yesamarcos

Retornando variável de uma classe

May 30th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.18 KB | None | 0 0
  1. <?php
  2.  
  3. class Usuario {
  4.  
  5.     private $nome;
  6.  
  7.     public function retornanome(){
  8.         return $this->nome = "Marcos Vinícius";
  9.     }
  10. }
  11.  
  12. $obj = new Usuario;
  13. echo $obj->retornanome();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement