zfred09 Posted July 5, 2007 Share Posted July 5, 2007 Say I had $string = "I swear I have seen this before."; I want to add $addme = "**"; into the original string after 10 characters. How would I do this? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 5, 2007 Share Posted July 5, 2007 Just need to use substr(): <?php $string = "I swear I have seen this before."; $addme = '**'; $add_after = '10'; $new_string = substr($string,0,$add_after).$addme.substr($string,$add_after); echo $new_string; ?> Quote Link to comment Share on other sites More sharing options...
zfred09 Posted July 5, 2007 Author Share Posted July 5, 2007 Ok, that seems to work. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.