hoopplaya4 Posted August 2, 2009 Share Posted August 2, 2009 Hi, I'm wondering if there's something similar to array_unique, but for strings? For example, I have a string: $ids = "23,24,25,24,24,24"; Is there anyway to strip the string down so that it keeps the unique numbers separated by the commas? Thus, I would retrieve from the $ids above: 23,24,25. Thanks! Link to comment https://forums.phpfreaks.com/topic/168473-solved-array_unique-for-strings/ Share on other sites More sharing options...
.josh Posted August 2, 2009 Share Posted August 2, 2009 you could explode it, use array_unique, and then implode it. Link to comment https://forums.phpfreaks.com/topic/168473-solved-array_unique-for-strings/#findComment-888692 Share on other sites More sharing options...
hoopplaya4 Posted August 2, 2009 Author Share Posted August 2, 2009 Sweet, thanks! Link to comment https://forums.phpfreaks.com/topic/168473-solved-array_unique-for-strings/#findComment-888700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.