Hi,
try something like this:
<?PHP
$m1 = 100;
$m2 = 65;
$m3 = 5;
$x = array($m1,$m2,$m3);
$arrRepeat = array(1,2,3,5,6,7,8,9,10,11);
$n = 1;
foreach ($x as $v) {
// variable name
$var = "md".$n;
// shorter than if..else, repeat || num times
$num = floor($v/10) > 9 ? 9 : floor($v/10);
// the following line doesn't do it because
// there is a bigger step between 20 and 30
// so we use $arrRepeat instead
//${$var} = str_repeat("||",$num+1);
${$var} = str_repeat("||",$arrRepeat[$num]);
$n++;
}
// print the values
echo $md1."-".$md2."-".$md3."<br>\n";
?>
Thomas