class test {
    public $isNew;
    public function isNew(){}
}
$ins = new test();
$ins->isNew
Here,how does php parse $ins->isNew?
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.
$ins->isNew is the variable.
$ins->isNew() is the function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With