PHP override get set methods
<p>Is it possible to override the get and set methods for parameters that I already have set?  So every time I set a param I have access to work with it/ validate it?</p>

<pre><code>class User {

   public $username;

   function custom_set($name, $value) {
      if(strlen($value) &lt; 5) {
        return "not long enough";
      } else {
        $this-&gt;$name = $value;
      }

   }  
}

$u = new User();
$u-&gt;username = "ted";
echo $u-&gt;username;
</code></pre>

<p>Outputs: "not long enough"</p>

<p>This is a very simplified example that I just wrote out and probably contains errors, it's just to convey what I am trying to do.  </p>

<p>Basically everytime I call <code>$u-&gt;username = "anything";</code> I want the <code>custom_set</code> method to be called.</p>

<p>I don't want to do the validation in the constructor and I don't want to create separate methods like <code>$u-&gt;setVal("ted");</code></p>

<p>Is this possible?</p>
