Re: Making stdClass iterable

From: Date: Mon, 14 Jan 2019 14:58:09 +0000
Subject: Re: Making stdClass iterable
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-103732@lists.php.net to get a copy of this message
On Mon, 14 Jan 2019 at 14:48, Rowan Collins <rowan.collins@gmail.com> wrote: > Currently, it has no methods, and matches no type checks other than itself > and "object"; in a sense, it doesn't even have any properties, just the > ability to add them dynamically. To me, that makes sense: it's the > "classless object", the absolute bare minimum any object could be. > Apologies for the multiple replies, but it just occurred to me that with anonymous classes, we can define something even more minimal: $foo = new class {}; $bar = new stdClass; Given that stdClass is returned as a "default structureless object" by a lot of internal functions, what is the justification for $foo and $bar here behaving differently? Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#103732) next »