Re: vsprintf()
| From: | Richard Quadling | Date: | Wed, 24 Apr 2013 16:36:36 +0000 |
| Subject: | Re: vsprintf() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-67129@lists.php.net to get a copy of this message | ||
On 24 April 2013 17:31, Richard Bradley <Richard.Bradley@softwire.com>wrote:
> > -----Original Message-----
> > From: Rasmus Schultz [mailto:rasmus@mindplay.dk]
> > Sent: 24 April 2013 16:45
> > To: PHP internals
> > Subject: [PHP-DEV] vsprintf()
> >
> > This is all kinds of wrong:
> >
> > http://3v4l.org/UZFME
> >
> > So the order in which the properties were defined is the magic that
> makes this work.
> >
> > Wow. WTF?
> >
> > Do I need to explain in detail why this is all kinds of effed up?
>
> Yes, please.
>
> What's the big deal here? If you coerce an object to an array, you get the
> public
> properties in the order in which they were declared.
>
> See http://www.php.net/manual/en/language.types.array.php
>
> "If an object is converted to an array, the result is an array whose
> elements are the
> object's properties. The keys are the member variable names, with a few
> notable
> exceptions: ...."
>
> What was the point of your email? Did you hope for some action to arise,
> or are
> you just letting off steam?
>
> Best,
>
>
> Rich
Oh! Another magic method opportunity ...
/**
* Operates just like __toString(), but returns an array.
*/
public function __toArray();
(ducking)
--
Richard Quadling
Twitter : @RQuadling