<?php $items = [1, 2, 3]; $multiplier = 2; $doubledItems = array_map(function ($item) use ($multiplier) { return $item * $multiplier; }, $items);