<?PHP
function unique_text($array, $limit = 3 ) {
$array = array_unique($array);
$plus = 1;
$text = array();
foreach( $array as $value ) {
$text[] = $value;
if( $plus == $limit )
break;
$plus++;
}
$text = implode(',', $text);
return $text;
}
?>Kullanım
$array = array('test 1', 'test 2', 'test 3', 'test 4', 'test 5', 'test 2', 'test 1');
echo unique_text($array, 5);
/* Çıktı : test 1,test 2,test 3,test 4,test 5 */İlk değer tekrar kayıtları sileceğin dizi ikincisi ise misal tekrar kayıtları hesaba katarak 5 fazla değer döndürdün ama bunların hepside benzersiz olursa fazla olanları budamak için limit