Re: [PATCH] Making in_array a language operator

From: Date: Mon, 14 Nov 2011 06:02:51 +0000
Subject: Re: [PATCH] Making in_array a language operator
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 13.11.11 19:08, Pierre Joye wrote:
> 2011/11/13 Antoine Delignat-Lavaud <[email protected]>:
>> On Sun, 2011-11-13 at 14:23 +0100, Pierre Joye wrote:
>>>
>>> There is an idea to have pseudo object for common types, where these
>>> functions would be callable without actually having an instance. No
>>> implementation yet so far.
>>
>> So this means being able to use $string->strlen() (or even $string->len())
>> instead of strlen($string) or $array->in_array($x) ($array->in($x)) instead
>> of in_array($x,$array), right?
> 
> Yes, that's the idea, but then with obvious names:
> 
> $string->length(); or $string->length;
> $array->in($x);

That last one doesn't sound right. Didn't you mean $x->in($array)? Or at
least $array->contains($x)?

- Martin


Thread (9 messages)

« previous php.internals (#56321) next »