PHP RFC: Comprehensions

Another interesting RFC recently landed to PHP community. So far the easiest way of explaining comprehensions for me comes from Python world: Comprehensions are constructs that allow sequences to be built from other sequences. Here’re some examples from List comprehensions in Python: def palindromes(strings): return [s + s[::-1] for s in strings] def starting_with(letter, names): return [name for name in names if name[0].lower() == letter.lower()] JavaScript, however, decided to remove its support from standard in favour of filter/arrow/map functions....

April 13, 2019 · 1 min · anvyst