Advertisement
Wotan_Volsung

Exemplo de classe PHP

Jan 30th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.     class Classe{
  3.         private $a;
  4.  
  5.         public function __set($atributo, $valor) {
  6.             switch($atributo) {
  7.                 case "a":
  8.                     $this->$a = $valor;
  9.                 break;
  10.             }
  11.         }
  12.  
  13.         public function __get($atributo) {
  14.             switch($atributo) {
  15.                 case "a":
  16.                     return $this->$a;
  17.                 break;
  18.             }
  19.         }
  20.  
  21.         public function Decodifica() {
  22.             return base64_decode($this->a);
  23.         }
  24.     }
  25.  
  26.     $classe = new Classe();
  27.     $classe->a = "IkV1IHF1ZSBu428gZnVtbyBxdWVyaWEgdW0gY2lnYXJybw0KRXUgcXVlIG7jbyBhbW8gdm9j6g0KRW52ZWxoZWNpIGRleiBhbm9zIG91IG1haXMgbmVzc2Ug+mx0aW1vIG3qcyI=";
  28.     echo $classe->Decodifica();
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement