pneudralics Posted May 1, 2009 Share Posted May 1, 2009 $string = "Hi this is my string"; //Want it to look like $string = "Hi-this-is-my-string"; Quote Link to comment https://forums.phpfreaks.com/topic/156366-solved-how-can-i-take-a-string-and-replace-the-space-with-a-dash/ Share on other sites More sharing options...
mikesta707 Posted May 1, 2009 Share Posted May 1, 2009 $string = str_replace(" ", "-" $string); Quote Link to comment https://forums.phpfreaks.com/topic/156366-solved-how-can-i-take-a-string-and-replace-the-space-with-a-dash/#findComment-823264 Share on other sites More sharing options...
pneudralics Posted May 1, 2009 Author Share Posted May 1, 2009 Thanks. Just forgot the , $string = str_replace(" ", "-", $string); Quote Link to comment https://forums.phpfreaks.com/topic/156366-solved-how-can-i-take-a-string-and-replace-the-space-with-a-dash/#findComment-823273 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.