title: Why can't we use the "new" keyword in a class property?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9159202/instance-as-a-static-class-property">Instance as a static class property</a>  </p>
  </blockquote>
  
  
  
  <p>I got a problem about creating an Object in a class as an attribute.</p>
  
  <pre><code>include 'Bar.php';
  class Foo()
  {
      private $bar = new Bar();
  }
  </code></pre>
  
  <p>It comes out a parse error. But when I put the $bar outsite class</p>
  
  <pre><code>include 'Bar.php';
  class Foo()
  {
      //private $bar = new Bar();
  }
  $bar = new Bar();
  </code></pre>
  
  <p>No syntax error. works perfectly. So what's the problem. I just ported my Java knowledge to PHP. Sometimes, its so confusing.</p>