I need a function that inserts a string in a string at a sertain position, since this is not provided in php, I wrote the function myself, but ist doesn't work as it suposed to. here's the code:
<?
function insertstr ($str,$where,$insstr) {
return substr($str,0,$where).$insstr.substr($str,-(strlen($str)-$where));
}
?>
sometimes (at the first insert of a string i think) it adds $insstr twice, but I really can't see what's wrong, please help me 🙂