View Single Post
10-26-2009, 01:18 PM
Join Date: Nov 2007
Location: the Netherlands
Ill try to explain quickly:
The use of :: is when you want to call a method of a class directly. You use -> on an object of a class.
An object is een instance of a class (e.g. $obj = new ClassName();) this means that the object is a piece that inheritted all kinds of properties and methods from the class. The class is the blueprint for the object. When you want to access the method from the object, you use $obj->myMethod(). What myMethod does all depents how the blueprint (class) looks like.
Now the :: operator removes the whole instance class, with it you can skip it all and access the method directly. The only downside is that your method wont be able to use the $this property.
Calling a method via :: is called a static call. (In many other languages, you first have to declare your function static before you are able to call it on a static way)
Who doesn't like martial arts? =)
View Public Profile
Send a private message to Jim
Visit Jim's homepage!
Find More Posts by Jim