stitcher.io: Short closures in PHP

  • You are here: Free PHP » Uncategorized » stitcher.io: Short closures in PHP

Short closures, also called arrow functions, are a way of writing shorter functions in PHP. This notation is useful when passing closures to functions like array_map or array_filter.

This is what they look like: // A collection of Post objects $posts = [/* … */];

$ids = array_map(fn($p...

Powered by Gewgley