Source Code:
(back to article)
<?php $originalArray = [1, 2, 3, 4, 5]; $newArray = array_map(function ($value) { return $value == 3 ? 9 : $value; }, $originalArray); print_r($newArray);
Result:
Report an issue