wzul

Sample Class

Jan 23rd, 2017
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | None | 0 0
  1. <?php
  2. class Wan
  3. {
  4.     var $price;
  5.     var $desc;
  6.  
  7.     function setPrice($a)
  8.     {
  9.         $this->price = $a;
  10.     }
  11.     function getPrice()
  12.     {
  13.         echo $this->price;
  14.     }
  15.     function setDesc($a)
  16.     {
  17.         $this->desc = $a;
  18.     }
  19.     function getDesc()
  20.     {
  21.         echo $this->desc;
  22.     }
  23. }
  24. $obj = new Wan;
  25. $obj->setPrice(12);
  26. $obj->getPrice();
  27. $obj->setDesc("Wan");
  28. $obj->getDesc();
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment