array_walk visits each value and can update values by reference.

Walk Update

walk_update.php
<?php
function prefix_value(&$value, $key, $prefix) {
    $value = $prefix . $value;
}

$prefix = ;
$names = ["Ada", "Linus"];
array_walk($names, "prefix_value", $prefix);
$summary = implode(",", $names);

echo "prefix=" . $prefix . "\n";
echo "names=" . $summary . "\n";
<?php
function prefix_value(&$value, $key, $prefix) {
    $value = $prefix . $value;
}

$prefix = ;
$names = ["Ada", "Linus"];
array_walk($names, "prefix_value", $prefix);
$summary = implode(",", $names);

echo "prefix=" . $prefix . "\n";
echo "names=" . $summary . "\n";
<?php
function prefix_value(&$value, $key, $prefix) {
    $value = $prefix . $value;
}

$prefix = ;
$names = ["Ada", "Linus"];
array_walk($names, "prefix_value", $prefix);
$summary = implode(",", $names);

echo "prefix=" . $prefix . "\n";
echo "names=" . $summary . "\n";
visit and update Use `array_walk` when the callback should touch each existing value.