Could you please let me know how I can solve the following problem with array sort.
After I sort and delete duplicates from array $keywords_main of strings I get following changes to array elements:
CASE 1:
Before sort => [3, 5, 7]
sort:
$keywords_main = array_flip($keywords_main);
array_multisort($keywords_main);
$keywords_main = array_flip($keywords_main);
After sort => [0, 1, 2]
CASE 2:
(notice: there is space between 5 and 5 in second array element)
Before sort => [33, 5 5, 7]
sort:
$keywords_main = array_flip($keywords_main);
array_multisort($keywords_main);
$keywords_main = array_flip($keywords_main);
After sort => [ 0, 5 5, 1]
I would like to have array not change the value of its elements to the position number as it happens in this case. If array elements are words, then there is no problem.
Thank you,