Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Compare classes interface

By: sectus on Mar 21st, 2013  |  syntax: PHP  |  size: 0.84 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ----- first version -----
  2. namespace vendor\package;
  3.  
  4. class someClass
  5.     {
  6.     private $c;
  7.     public function __construct($a, $b)
  8.         {
  9.         $c = $a + $b;
  10.         }
  11.     /**
  12.      * @return string
  13.      */
  14.     public function returnC()
  15.         {
  16.         return $this->c;
  17.         }
  18.     public function saySomething()
  19.         {
  20.         echo 'something';
  21.         }
  22.     }
  23.  
  24. ----- second version -----
  25. namespace vendor\package;
  26.  
  27. class someClass
  28.     {
  29.     private $a, $b;
  30.  
  31.     public function __construct($a, $b)
  32.         {
  33.         $this->a = $a;
  34.         $this->b = $b;
  35.         }
  36.  
  37.     public function saySomething($something = 'something')
  38.         {
  39.         echo $something;
  40.         }
  41.  
  42.     /**
  43.      * @return integer
  44.      */
  45.     public function returnC()
  46.         {
  47.         return $this->a + $this->b;
  48.         }
  49.  
  50.     }