I am using preg_match_all to pull phone numbers from a thread. This puts them into an array, im applying both rsort and array_unique to the matches variable, however they have no effect what so ever... The array_unique would eliminate matches that only come up from a quote or response duplicate, and the rsort should make the last index the first, the second to last index, second, etc...
preg_match_all('~0-9]{3}-[0-9]{3}-[0-9]{4}~', $data, $matches)
$result = array_unique($matches);
rsort($result);
var_dump($result);
Output:
array
0 =>
array
0 => string '111-111-1111' (length=12)
1 => string '222-222-2222' (length=12)
2 => string '333-333-3333' (length=12)
3 => string '444-444-4444' (length=12)
4 => string '555-555-5555' (length=12)
5 => string '555-555-5555' (length=12)
6 => string '555-555-5555' (length=12)
Needs to be:
array
0 =>
array
0 => string '555-555-5555' (length=12)
1 => string '444-444-4444' (length=12)
2 => string '333-333-3333' (length=12)
3 => string '222-222-2222' (length=12)
4 => string '111-111-1111' (length=12)