Why are static properties unavailable with "->" but are accessible with "::"?
Here is the documentation from the static
keyword of PHP.net:
A property declared as static cannot be accessed using an instance of a class object (although a static method can be used).
So why does the following code work?
Here is their sample code (I abbreviated it):
<?php class Foo { public static $my_static = 'foo'; } $foo= new Foo(); print $foo::$my_static; //print 'foo' ?>
Why $foo::$my_static still
work here? Thanks everyone!
+5