daveh33 Posted November 21, 2007 Share Posted November 21, 2007 I have a variable called $name - how can I validate this variable so if there is any spaces, it replaces it with a + for example - if the value is John Smith, its new value would be John+Smith if the value is John, its value would remain the same, John. Please let me know if this is possible and how I can do it. Quote Link to comment https://forums.phpfreaks.com/topic/78255-solved-validate-variable-remove-spaces/ Share on other sites More sharing options...
Orio Posted November 21, 2007 Share Posted November 21, 2007 Simple... $str = str_replace(" ", "+", $str); Orio. Quote Link to comment https://forums.phpfreaks.com/topic/78255-solved-validate-variable-remove-spaces/#findComment-396005 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.