title: Which is the better approach to initialize php properties?
body: <p>Here are two way to initialize class variables.</p>
  
  <h2>1st Method</h2>
  
  <pre><code>class Test {
      private $var1;
      private $var2;
  
      public function Test($var1,$var1) {
          $this-&gt;var1 = $var1;
          $this-&gt;var2 = $var2;
      }
  }
  $objTest = new Test("value1","value2");
  </code></pre>
  
  <h2>2nd Method</h2>
  
  <pre><code>class Test {
      private $var1;
      private $var2;
  
      public function _set($var, $value) {
          $this-&gt;$$var = $value
      }
  }
  $objTest = new Test();
  $objTest-&gt;_set('var1','value1');
  $objTest-&gt;_set('var2','value2');
  </code></pre>
  
  <p>Now, these both methods are valid, but I would like to know which one in better in what conditions? What are pros and cons of sticking with one method only?</p>