title: troubles with variables in PHP
body: <p>I am new in PHP but from Java background. I am in a confusion with the following code:</p>
  
  <pre><code>class Student
  {
      //public $name;
      public function __construct($name)
      {
          $this-&gt;name=$name;
      }
      public function showname()
      {
          echo $this-&gt;name;
      }
  }
  </code></pre>
  
  <p>On the above code if I comment the line <code>public $name;</code> it still works. However, in Java it is not supposed to work. I want to understand this behavior in PHP.</p>