dietkinnie Posted March 30, 2009 Share Posted March 30, 2009 Hi Guys, Can anyone help me figure this out, if possible ? I need to split the following: Peter - Jane: High/Low To $var1 = peter $var2 = Jane $var3 = High/Low Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/151722-solved-splitting-with-multiple-seperators-to-variables/ Share on other sites More sharing options...
Mark Baker Posted March 30, 2009 Share Posted March 30, 2009 $text = 'Peter - Jane: High/Low'; $tmp = explode('-',$text); $var1 = trim($tmp[0]); $tmp = explode(':',$tmp[1]); $var2 = trim($tmp[0]); $var3 = trim($tmp[1]); Link to comment https://forums.phpfreaks.com/topic/151722-solved-splitting-with-multiple-seperators-to-variables/#findComment-796742 Share on other sites More sharing options...
dietkinnie Posted March 30, 2009 Author Share Posted March 30, 2009 $text = 'Peter - Jane: High/Low'; $tmp = explode('-',$text); $var1 = trim($tmp[0]); $tmp = explode(':',$tmp[1]); $var2 = trim($tmp[0]); $var3 = trim($tmp[1]); Hi Mark, Thanks this is what i was looking for. Link to comment https://forums.phpfreaks.com/topic/151722-solved-splitting-with-multiple-seperators-to-variables/#findComment-797012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.