I’d do the following:
$prefix = 'HPO';
foreach ($values as $value){
//loop trhough the values
$string ='';
$string = sprintf("%'.010d\n", $value);
$string = $prefix.$string;
echo $string;
}
sprintf will help you to build complex strings with length control and many more features. See the manual for more informations.
solved Change values in an array