Home / PHP Tips Generated By ChatGPT / Mapping Array Elements in PHP Apply a function to every element of an array, useful for transforming array values. Source Code $squared = array_map(function($n) { return $n * $n; }, $numbers); print_r($squared);