Here is a shorter version of Kees van Dieren's function below, which is moreover compatible with the syntax of str_repeat:
<?php
function str_repeat_extended($input, $multiplier, $separator='')
{
return $multiplier==0 ? '' : str_repeat($input.$separator, $multiplier-1).$input;
}
?>