No, this construct cannot be avoided with the built-in PHP concept for OOP.
PHP, like JavaScript, Python, and Perl - but unlike Java and not always like Ruby - always requires an explicit receiver - or $this for the "current instance" - to access the elements. The syntax is just the form that PHP uses to refer to this construct, and it was probably heavily influenced by the "be late come" language and match it. It also resembles Perl / C syntax.
While the location may be changed or the number of sites may be reduced, at the end of the day it is a method of accessing members.
Happy coding.
user166390
source share