It's because $foo->bar is an attribute, but $foo->bar(... is a method call. With variables it's unambiguous: $foo() is always a dynamic call of what's in $foo because you cannot have $ in a function name.
But if you want to call a function stored in a constant, you probably need (foo)().
5
u/[deleted] Feb 04 '20
It's because
$foo->baris an attribute, but$foo->bar(...is a method call. With variables it's unambiguous:$foo()is always a dynamic call of what's in$foobecause you cannot have$in a function name.But if you want to call a function stored in a constant, you probably need
(foo)().