Re: List comprehensions and generator expressions for PHP
| From: | David Muir | Date: | Fri, 29 Jun 2012 04:46:35 +0000 |
| Subject: | Re: List comprehensions and generator expressions for PHP | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61035@lists.php.net to get a copy of this message | ||
On 28/06/12 23:45, Sebastian Krebs wrote:
> Hi,
>
> 2012/6/28 David Muir <davidkmuir@gmail.com>
>
>> I'd assume that array_map() only works with arrays, while list
>> comprehension should work with anything traversable.
>>
> That sounds more like a "bug" (better: "Missing feature") in array_map()
> and less a missing language feature...
All the array_* functions only work with arrays, and don't allow
objects, even ones implementing ArrayAccess.
It's been there as a feature request since 2007:
https://bugs.php.net/bug.php?id=43650
Cheers,
David