drisate Posted May 6, 2010 Share Posted May 6, 2010 Hey guys i have a string that looks like this -3--3--3--3--3--3--3--3--3--3--10--10--10--10--10--10--10--10--10--10--7--7--7--7--7--7--7--7--7--7--12--12--12--12--12--12--12--12--12--12--1--1--1--1--1--1--1--1--1--1--19--19- How can i remove the duplicates so it looks like -3--10--7--12--1--19- It needs to be fast because there will be a lot of strings to be checked Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted May 6, 2010 Share Posted May 6, 2010 these functions might help you array_unique explode implode preg_match Quote Link to comment Share on other sites More sharing options...
drisate Posted May 6, 2010 Author Share Posted May 6, 2010 Thx this is what i did for future ref $list3 = implode("-" , array_unique(explode("-",$bouton[bouton]))); $ex = explode ('-', $list3); foreach($ex as $value){ if ($value){ $string .= "-$value-"; } } Quote Link to comment 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.