Vivid Lust Posted February 18, 2009 Share Posted February 18, 2009 Hey all, how could I Insert "_" where there is a gap in a string? Such as: This is a sentence Becomes: This_is_a_sentence Thanks all! Link to comment https://forums.phpfreaks.com/topic/145778-solved-insert-_-where-there-is-a-gap/ Share on other sites More sharing options...
Prismatic Posted February 18, 2009 Share Posted February 18, 2009 str_replace(" ", "_", $string); Link to comment https://forums.phpfreaks.com/topic/145778-solved-insert-_-where-there-is-a-gap/#findComment-765379 Share on other sites More sharing options...
Vivid Lust Posted February 18, 2009 Author Share Posted February 18, 2009 Oh, and then how could I do the reverse? Thanks Link to comment https://forums.phpfreaks.com/topic/145778-solved-insert-_-where-there-is-a-gap/#findComment-765380 Share on other sites More sharing options...
Prismatic Posted February 18, 2009 Share Posted February 18, 2009 str_replace("_", " ", $string); Link to comment https://forums.phpfreaks.com/topic/145778-solved-insert-_-where-there-is-a-gap/#findComment-765381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.