title: PHP: declare a class variable to be a stdClass object
body: <p>This is probably pretty simple but I haven't been able to figure out how to phrase the question for Google, so here goes:</p>
  
  <p>So, I often do something like this...</p>
  
  <pre><code>class foo {
      private $bar = array();
  }
  </code></pre>
  
  <p>... to set some class property to be an array. However, I'd like to make a private property an object instead, something like this:</p>
  
  <pre><code>class foo {
      private $bar = new stdClass();
  }
  </code></pre>
  
  <p>I tried several variations of this and none of them worked. Can this be done? For bonus points can you assign a private property to be any other class of object?</p>
  
  <p>Thanks!</p>