2 [1] => 4 [2] => 6 [3] => 8 [4] => 10 ) $names = ['alice', 'bob', 'charlie']; // Capitalize each name $capitalizedNames = array_map('ucfirst', $names); print_r($capitalizedNames); // Output: Array ( [0] => Alice [1] => Bob [2] => Charlie ) $products = [ ['id' => 1, 'name' => 'Laptop', 'price' => 1200], ['id' => 2, 'name' => 'Mouse', 'price' => 25] ]; // Add a formatted price string to each product $formattedProducts = array_map(function($product) { $product['formatted_price'] = '$' . number_format($product['price'], 2); return $product; }, $products); print_r($formattedProducts); /* Output: Array ( [0] => Array ( [id] => 1 [name] => Laptop [price] => 1200 [formatted_price] => $1,200.00 ) [1] => Array ( [id] => 2 [name] => Mouse [price] => 25 [formatted_price] => $25.00 ) ) */ ?>