Wednesday, April 8, 2015

Shorter version of Kees van Dieren's function - PHP Snippet

Shorter version of Kees van Dieren's function - PHP Snippet

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