If you need an alternate str_repeat function that outputs an exact length using a particular input string to fill that length (as opposed to repeating the input string), try this little gem:
<?php
function str_repeat2($input, $length) {
$answer="";
if ($length>=1 && strlen($input)>=1) {
$answer = substr(str_repeat($input, ceil($length/strlen($input)) ), 0, $length);
}
return $answer;
}
$t="-=-";
print str_repeat2($t,0)."\n";
print str_repeat2($t,1)."\n";
print str_repeat2($t,2)."\n";
print str_repeat2($t,3)."\n";
print str_repeat2($t,4)."\n";
print str_repeat2($t,5)."\n";
print str_repeat2($t,6)."\n";
?>