Re: Re: Anonymous classes share static space?
| From: | Christoph M. Becker | Date: | Mon, 23 Oct 2017 20:56:29 +0000 |
| Subject: | Re: Re: Anonymous classes share static space? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326243@lists.php.net to get a copy of this message | ||
On 23.10.2017 at 21:47, David Harkness wrote:
> On Mon, Oct 23, 2017 at 12:23 PM, Andrey Repin <anrdaemon@freemail.ru>
> wrote:
>
>> Ok, then following your statement, this code: ™6$›”@•H€¬¸
>> ^˜https://3v4l.org/Bgjqn
>> should yield: D/D… Since objects are of the same class…
>
> No, $c and $d were created from different classes and thus do not share
> static properties. That the definitions of the classes are identical is
> beside the point. I expect that PHP defines a single anonymous class at
> each source location without regard for its properties and methods.
Indeed, or as stated in the PHP manual[1]:
| All objects created by the same anonymous class declaration are
| instances of that very class.
[1] <http://www.php.net/manual/en/language.oop5.anonymous.php>
--
Christoph M. Becker