Am 28.06.2018 um 16:52 schrieb Levi Morrison:
I think there has been a lack of discussion about why this is desired.
For me, it's always been implementing certain kinds of iterators that
wrap arrays. This means that functions which return both the key and
value are optimal for me. As I already outlined the functions which
return the key-value pair are the most general and do result in clean
code without drawbacks, at least for this use-case.

Some people do not like this idea. One potential implication this that
maybe their use-case is not the same as mine. What use-cases do other
people have for this? Why are you wanting to grab the first or last
value? What data structure or algorithm is this a bigger part of?
Hi Levi,

sorry for the long-lasting answer.

I use plain arrays relatively often when I develop caching mechanics for multiple rather complex entities. I query a set of suitable entites and store them as a plain array eg. in Redis. Each request now fetches this preprocessed entities. Sometimes all entities are required but I also have use cases where I filter/sort the list of entries and only one entity is interesting (in all cases I experienced either the first or the last element). This is my initial use case for this RFC.

Are there other opinions about the necessity of this functions?

Regards,
Enno



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to