On 13-03-19 23:30, Rowan Collins wrote:
> At risk of complicating things further, might the solution to that be to
> have a shorter syntax for iterator_to_array in general?
>
> It's a shame array-casts are defined for arbitrary objects, else we
> could have (array)$iterator - and therefore (array)[foreach ($users as
> $user) yield $user->firstName]
A shorter alternative for iterator_to_array() could work as well I
think. Casting would have been stellar, but not feasible. However, could
using the array() built-in work? Something like:
array([foreach ($users as $user) yield $user->firstName])
Just thinking out loud here...
Regards,
Dik Takken
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php