Possible Duplicate:
In PHP, whats the difference between :: (double colon) and -> (arrow)?
I just had a quick question about what seems to me to be two different ways of doing the same thing. If there are difference other than syntax, please explain what they are.
We'll assume we have a class called MyClass
with a method called myMethod
. What's in them probably isn't relevant, because we're just going to be calling them from another file.
Here's the first way that I know of (there may be other ways - these are what I know):
$myvar = new MyClass();
$myvar->myMethod();
And the second way:
MyClass::myMethod();
If there are other ways, particularly better ways, by all means elaborate on them, but the main question here is the difference between these two examples.
Thanks!