title: Declaring protected variables in methods
body: <p>I've had a good look round and can't seem to find an answer to this problem.</p>
  
  <p>Basically I'm using the _call method to dynmically generate get and set methods, however when declaring a variable PHP's default is public. Is there anyway to declare a variable from within a class as protected?</p>
  
  <pre><code>function __call($method, $arguments) {
      $prefix = strtolower(substr($method, 0, 3));
      $property = strtolower(substr($method, 3));
  
      if (empty($prefix) || empty($property)) {
          return;
      }
  
      if ($prefix == "get" &amp;&amp; isset($this-&gt;$property)) {
          return $this-&gt;$property;
      }
  
      if ($prefix == "set") {
  
          $this-&gt;$property = $arguments[0];
      }
  }
  </code></pre>