On Wed, 2013-04-24 at 12:54 -0500, Ralph Schindler wrote:
I must have left the public in there when I posted it to twitter.
I'd
have to say it's a little unintuitive when the properties are
protected,
but all in all, I don't dislike the behavior. Perhaps this just
needs
to be
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?
- Rasmus Schultz
On Wed, Apr 24, 2013 at 9:45 AM, Rasmus Schultz ras...@mindplay.dk wrote:
Do I need to explain in detail why this is all kinds of effed up?
Yes, I'd like that explanation.
On Wed, 2013-04-24 at 11:45 -0400, Rasmus Schultz wrote:
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?
vsprintf()'s
-Original Message-
From: Rasmus Schultz [mailto:ras...@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
On 24 April 2013 17:31, Richard Bradley richard.brad...@softwire.comwrote:
-Original Message-
From: Rasmus Schultz [mailto:ras...@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
Richard,
Oh! Another magic method opportunity ...
/**
* Operates just like __toString(), but returns an array.
*/
public function __toArray();
(ducking)
I know you're joking, but this has been brought up before (and I intend to
bring it up again):
Well, since I was the one who posted it
(https://twitter.com/ralphschindler/status/327084619507855361), I'll
further explain it. I realized it was doing this when actually running
this kind of snippet:
http://3v4l.org/ZkE6B
I must have left the public in there when I posted it to twitter.
Frankly, a magic method sounds like a much better solution than
auto-magically converting objects to arrays.
The problem with automatic conversion, is that the order of properties is
an implementation detail - the vsprintf() example perfectly illustrates the
problem:
class User
{
public
Hi Derick,
in php-src/main/php_sprintf.c
PHPAPI int
php_sprintf (char*s, const char* format, ...)
{
va_list args;
char *ret; //ret should be of type integer as vsprintf returns int
rather than char*
va_start (args, format);
s[0] = '\0';
ret = vsprintf (s, format, args);
va_end
10 matches
Mail list logo