godsent Posted February 6, 2009 Share Posted February 6, 2009 For example string is $a = "one:two:three:four:five"; Is where's any way to obtain every word between ":"? To segment string in to these 5 words. Help me if you know Quote Link to comment https://forums.phpfreaks.com/topic/144061-string-analysis/ Share on other sites More sharing options...
JonnoTheDev Posted February 6, 2009 Share Posted February 6, 2009 Easy $words = explode(":",$a); print_r($words); You can then loop through the$words array Quote Link to comment https://forums.phpfreaks.com/topic/144061-string-analysis/#findComment-755893 Share on other sites More sharing options...
Mark Baker Posted February 6, 2009 Share Posted February 6, 2009 Or $string = "one:two:three:four:five"; $words = str_word_count($string,2); print_r($words); Quote Link to comment https://forums.phpfreaks.com/topic/144061-string-analysis/#findComment-755894 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.