This is my array:
Array ( [0] => sam [1] => ram [2] => shyam )
Array ( [0] => sam [1] => ram [2] => shyam [3] => mohan )
Array ( [0] => sam [1] => ram [2] => shyam [3] => mohan [4] => salman [5] => babu [6] => karan )
I want to remove duplicate names to get an output like sam,ram,shyam,mohan,salman,babu,karan. How can I achieve this?
<?php include 'config.php';
$db = new Database();
$db->select('post','*',null,null,'id',20); $result = $db->getResult(); if(count($result) > 0){ foreach($result as $row){
$string = $row['keyw'];
$string = $string;
$array = explode(',', $string);
print_r(array_merge($array)); }} ?>