dennismonsewicz Posted July 17, 2008 Share Posted July 17, 2008 Is there anyway to trim white space from a string but at the same time replace that white space with something? Quote Link to comment Share on other sites More sharing options...
ninedoors Posted July 17, 2008 Share Posted July 17, 2008 What do you want to do? Trim the whitespace form the end and beginning of the string and then replace the "left over" whitespace with whatever, say _? If that is the case I don't think there is a function for that but you can just do somethng like this <?php $string = "yourstring"; $newstring = str_replace(" ", "_", trim($string)); ?> Not sure if that is what you are looking for. Nick 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.