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 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; ?> 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
Archived
This topic is now archived and is closed to further replies.