Skip to content
loading...

re: PHP needs its own ES6 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Generics would solve so much problems with arrays. They would allow us to create type safe collections where we could implement all those functions...
 

Generics would be cool. On the other hand, it is already possible since PHP 7 to collect values of a single datatype. Just create a class and use type hinting. Here is an example: 3v4l.org/EKmWb

 

This actually the approach i've been using for quite some time now. I usually just implement IteratorAggregate and create adding methods. Still, this usually means that i implement a lot of these classes. Lots of repetition, lots of new files.

code of conduct - report abuse