[eluser]Hyra[/eluser]
The main difference, if not the only one, is that you use the double colon for static members, and the arrow for members
Static Member
Code:
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::$my_static . "\n";
$foo = new Foo();
print $foo->staticValue() . "\n";
print $foo->my_static . "\n"; // Undefined "Property" my_static
// $foo::my_static is not possible
print Bar::$my_static . "\n";
$bar = new Bar();
print $bar->fooStatic() . "\n";
Static method
Code:
class Foo {
public static function aStaticMethod() {
// ...
}
}
Foo::aStaticMethod();
So .. :: can only be used for static (non-changing) methods/members