title: Create an object from the current class in a static method - PHP
body: <p>I have some problems with my class Model and other classes so I made this simple example to explain my problem :</p>
  
  <pre><code>class person{
  
    public static $a = "welcome";
  
    public function __construct(){
                                 }
  
    public static function getobject()
    {
        $v = new person();
        return $v;
    }
  
  }
  
  class student extends person{
  
    public static $b = "World";
  
  }
  
  $st = student:getobject();//this will return person object but I want student object
  
  echo $st-&gt;$b; // There is an error here because the object is not student
  </code></pre>
  
  <p>So I want to know what to write instead <code>$v = new person();</code> to get the object of the last inherited class.</p>