simonp Posted March 13, 2009 Share Posted March 13, 2009 I'm getting a sort code input from a text box but people are typing it in different ways eg: 40-21-20 40 21 20 How can I strip away hyphens and spaces from this string so I just get: 402120 Thanks Simon Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted March 13, 2009 Share Posted March 13, 2009 if you ALWAYS want to do this on the string, just use str_replace function $string = str_replace("-","",$string) $string = str_replace(" ","",$string) Quote Link to comment Share on other sites More sharing options...
simonp Posted March 13, 2009 Author Share Posted March 13, 2009 Thanks lonewolf217! 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.