I have the class.
Class User {
private $_name;
private $_email;
public static function factory() {
return new __CLASS__;
}
public function test() {
}
}
and when i make a static method call using the syntax below.
User::factory();
it throws me following syntax error.
Parse error: syntax error, unexpected T_CLASS_C in htdocs/test/index.php on line 8
the error is being thrown because the Static factory() method is unable to create the object during the static method call.
and when i change the magic constant __CLASSS__ to the name of the current class i.e to User then it works.
what am i missing?
selfor$this? Do you need an new instance of the object?