Re: Static class property can be accessed as $object::$property?
| From: | Etienne Kneuss | Date: | Sun, 28 Feb 2016 13:02:10 +0000 |
| Subject: | Re: Static class property can be accessed as $object::$property? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91452@lists.php.net to get a copy of this message | ||
On Fri, Feb 26, 2016 at 7:12 PM <kelerest123@gmail.com> wrote:
> Hi,
>
>
> I'd be very thankful for a clear explanation on this:
> http://stackoverflow.com/questions/35656898
>
>
> May be it's just a word game and I don't understand it correctly, but
> documentation states one, though $object::$staticProperty works in all
> versions (tested on 3v4l).
>
$obj::$foo is a shortcut for $cl = get_class($obj); $cl::$foo;
The static property is stored at the level of the class. What the
documentation means is that you cannot access a static property using
$obj->foo; you have to use "::" .
Best,