- print_r: documentation ( source)
<?php
$array = array (1=>1, 2=> 2, 3 => array(1=>11, 2=>12, 3=>13));
$text = "test";
function modarr($array, $text) {
foreach ($array as $key => $arr) {
if(is_array($arr)) $res[$key] = modarr($arr,$text);
// modification function here
else $res[$key] = $arr.$text;
}
return $res;
}
$erg = modarr($array, $text);
print_r($erg);