Static methods and $this

March 28th, 2005. Tagged: PHP certification

The book tells about static methods but it forgets to mention that you cannot use $this in static methods. A static method is pretty much like a normal stand-alone function is not aware about the object as a whole. So you can call the static method when no object of that class exists. In this case the method would have no idea what $this is.

Tell your friends about this post on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov