array_unique not working as expected in php

matheus19

New Member
Here is a problem.i am exploding a list of character by new line in an array. and doing array unique on it. but it is not working as expected.below is code:\[code\]$list = "testoktesttestokoktest";$list_explode = explode("\n", $list); //exploding the characters of the list from the input//displaying unique array_map('trim', $list_explode);$result = array_unique($list_explode);print_r($result);\[/code\]The result is \[code\]Array ( [0] => test [1] => ok [6] => test )\[/code\]
 
Back
Top