Collections

Powerful array manipulation with method chaining

Collections wrap arrays with powerful chainable methods for filtering, mapping, and transforming data.

Transform each item in the collection.

Input
123
.map()
Output
246
PHP
collect([1, 2, 3])->map(fn ($n) => $n * 2);
// [2, 4, 6]