PHP allows access to non-static methods using ClassName:: But Why does it throw error when accessing non-static properties using ClassName::?


Statics are STATIC, they exist all the time. NON-STATIC means they only exist after you "new' and assign said resultant object to a variable, and will only exist on that variable. They never actually exist in memory on the class.

That's kind of the POINT of static and non-static... so if you're asking this you kind-of missed the point.

Show all replies

I think out of all the answers here yours make most sense to me. I think I now understand the why behind it. Thank you very much. 😊

Reply to this…

(3 answers) Take me to the question