I have an array that have multiple set of words, some of them might be duplicated, and i want to replace the duplicated words from array with word: duplicate, and also keep one original. So if i have 5 duplicates, i want 4 of them to be replaced with duplicate and keep original one
$my_array = (0=>'test', 1=>'test2',2=>'test3',3=>'test');
As you see in my array, the array keys 0 and 3 has same value, i want to replace the last value with word 'duplicate'
$my_array = (0=>'test', 1=>'test2',2=>'test3',3=>'duplicate');
I tried different methods but without success:(