class test {
public $isNew;
public function isNew(){}
}
$ins = new test();
$ins->isNew
Here,how does php parse $ins->isNew?
class test {
public $isNew;
public function isNew(){}
}
$ins = new test();
$ins->isNew
Here,how does php parse $ins->isNew?
See the chapter on Class Basic in the PHP manual:
$ins->isNew // class member
$ins->isNew() // class method
PHP is not a functional programming language where functions are also data. So $ins->isNew wouldn’t be ambiguous to either refer to the method isNew or the attribute isNew. $ins->isNew is always an attribute and $ins->isNew() a method call.