Re: Pseudo-objects (methods on arrays, strings, etc.)

From: Date: Thu, 19 Jul 2012 15:49:18 +0000
Subject: Re: Pseudo-objects (methods on arrays, strings, etc.)
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-61493@lists.php.net to get a copy of this message
On 07/19/2012 12:25 AM, Pierre Joye wrote: > hi Rasmus, > > On Wed, Jul 18, 2012 at 8:49 PM, Rasmus Lerdorf <rasmus@lerdorf.com> wrote: > >> This makes no sense to me either. How does it let us clean the APIs? Can >> you give an example? I have one: >> >> $a = -5; >> $b = "-5"; >> >> echo $a->abs(); // Outputs 5 >> echo $b->abs(); // should still output 5 >> >> What has been cleaned here over: >> >> echo abs($a); >> echo abs($b); > > Heh, here is another example where it makes even less sense: time(); > > sigh. > > More seriously... we are not talking about these APIs and I am sure > you know which one I refer to, like the string API and the like. Ok, so for the string API: $a = 1; $a->strstr('1'); should still work. All the string API methods need to be available on every pseudo-object regardless of the type. So I don't see any "cleanup" here either. -Rasmus

« previous php.internals (#61493) next »