inamul70 Posted January 17, 2012 Share Posted January 17, 2012 Dear all I m looking to to split string in two different variable which will split by '~'.. like i have sring " This is not I would like to do ~ what do you mean" var1 = "This is not I would like to do" var2 = "What do you mean" Thanks Link to comment https://forums.phpfreaks.com/topic/255202-string-manipulation/ Share on other sites More sharing options...
sandeep529 Posted January 17, 2012 Share Posted January 17, 2012 Try, list($var1,$var2) = explode('~'," This is not I would like to do ~ what do you mean"); echo $var1; echo $var2; Link to comment https://forums.phpfreaks.com/topic/255202-string-manipulation/#findComment-1308485 Share on other sites More sharing options...
nogray Posted January 17, 2012 Share Posted January 17, 2012 If you want to do it with javascript, you can use the split function e.g. var my_str = "This is not I would like to do ~ what do you mean"; var arr = my_str.split('~'); alert(arr[0]+' || '+arr[1]); Link to comment https://forums.phpfreaks.com/topic/255202-string-manipulation/#findComment-1308632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.