Guest Posted September 4, 2007 Share Posted September 4, 2007 How can I cut the content from a string everything before the first space? Quote Link to comment https://forums.phpfreaks.com/topic/67852-solved-cut-string/ Share on other sites More sharing options...
Neptunus Maris Posted September 4, 2007 Share Posted September 4, 2007 substr() function may help Quote Link to comment https://forums.phpfreaks.com/topic/67852-solved-cut-string/#findComment-341071 Share on other sites More sharing options...
jitesh Posted September 4, 2007 Share Posted September 4, 2007 <?php $str1 = "str1 str2 str3 str4"; $str_arr = explode(" ",$str1); $shift = array_shift($str_arr); $new_str = implode(" ",$str_arr); echo $new_str; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67852-solved-cut-string/#findComment-341074 Share on other sites More sharing options...
jitesh Posted September 4, 2007 Share Posted September 4, 2007 <?php $str = "str1 str2 str3 str4"; echo substr($str,strpos($str," ")+1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/67852-solved-cut-string/#findComment-341077 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.