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. 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. 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
Archived
This topic is now archived and is closed to further replies.