Code: Select all
$str=explode("\n",$str);
print_r($str);
$result=array_unique($str);
print_r($result);
I tried the above code and displayed the output.The values are entered in one textarea and the output is displayed in another textarea.The last value "aa" which is getting repeated should not be displayed,but it is getting displayed.
Input:
Array
(
[0] => cc
[1] => cc
[2] => bb
[3] => bb
[4] => aa
[5] => aa
)
Ouput:
Array
(
[0] => cc
[2] => bb
[4] => aa
[5] => aa
)
----------------------------------------------------------------------------
But the actual output needs to be
Array
(
[0] => cc
[2] => bb
[4] => aa
)
i.e $str[5] should not be displayed.kindly help