SteGriff

Blog

Next & Previous

Array Methods in LINQ, JS, and PHP

Array methods and lambdas! JavaScript has had them since ECMAScript 2015. DotNet has them in the form of LINQ, and PHP has had some variety since PHP 4.0.5(!)

I know them by their LINQ names and forget what they’re called elsewhere. This is my little memory extension.

LINQ JavaScript PHP What is it?
.Select .map array_map() Return an array copy with all members transformed by the given function
.Aggregate .reduce array_reduce() Reduce an array to a single value using an aggregation function
.Where .filter array_filter() Return an array with members satisfying the given function
.All .every array_walk()? Return true if all members satisfy the function
.Any .some ??? Return true if any members satisfy the function