title: Passing parameter by method or class?
body: <p>I have a class which is containing multiple methods. So I want to know which approach in better?</p>
  
  <p><strong>Passing by methods:</strong></p>
  
  <pre><code>class cls {
  
      function method1($var){
          echo $var;
      }
  
      function method2($var){
          echo $var;
      }
  
  }
  
  $obj = new cls;
  $obj-&gt;methodX($var); // X can be 1,2
  </code></pre>
  
  <p><strong>Passing by class:</strong></p>
  
  <pre><code>class cls {
  
      public $var;
      function __construct($var){
          $this-&gt;var = $var;
      }
  
      function method1(){
          echo $this-&gt;var;
      }
  
      function method2(){
          echo $this-&gt;var;
      }
  
  }
  
  $obj = new cls($var);
  $obj-&gt;methodX(); // X can be 1,2
  </code></pre>
  
  <p><strong>Note:</strong> I need to <code>$var</code> in all methods. Also in reality there is almost 10 methods.</p>