title: The advantage / disadvantage of private variables?
body: <p>I'm used to make pretty much all of my class variables private and create "wrapper" functions that get / set them:</p>
  
  <pre><code>class Something{
    private $var;
  
    function getVar(){
      $return $this-&gt;var;
    }
  
  }
  
  $smth = new Something();
  echo $smth-&gt;getVar();
  </code></pre>
  
  <p>I see that a lot of people do this, so I ended up doing the same :)</p>
  
  <p>Is there any advantage using them this way versus:</p>
  
  <pre><code>class Something{
    public $var;
  }
  $smth = new Something();
  echp $smth-&gt;var;
  </code></pre>
  
  <p>?</p>
  
  <p>I know that private means that you can't access them directly outside the class, but for me it doesn't seem very important if the variable is accessible from anywhere...</p>
  
  <p>So is there any other hidden advantage that I missing with private variables?</p>