mart94 Posted November 13, 2009 Share Posted November 13, 2009 Hi, i have a problem with searching from string. Something like this: $value = "abcdefghijkl"; $newvalue = "afkx"; And i need help to search each chr $newvalue from $value. After checking it would add letters from $newvalue to $value . But it wont duplicate letters, i mean: If found letter then it wont add, if letter isn't found add it. Not like this: $value = "aabcdeffhijkklx"; Like this: $value = "abcdefghijklx"; All The Best: Mart Quote Link to comment https://forums.phpfreaks.com/topic/181383-solved-string-splitting-and-more-help-neended/ Share on other sites More sharing options...
JonnoTheDev Posted November 13, 2009 Share Posted November 13, 2009 <?php $value = "abcdefghijkl"; $newvalue = "afkx"; $array = array_unique(array_merge(str_split($value),str_split($newvalue))); sort($array); $x = implode("",$array); print $x; ?> Quote Link to comment https://forums.phpfreaks.com/topic/181383-solved-string-splitting-and-more-help-neended/#findComment-956812 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.