an array defined like this, how do we take out the repeating data here
so, the array $data we defined as
$player0['id'] = 0;
$player0['name'] = 'player0';
$player1['id'] = 1;
$player1['name'] = 'player1';
//look, there are one repeated data, 2 player 0's
$player2['id'] = 0;
$player2['name'] = 'player0';
$data[$i]['team_id']= 0;
$data[$i]['team'][] = $player0;
$data[$i]['team'][] = $player1;
$data[$i]['team'][] = $player2;
//so now, $data[$i]['team'][0] and $data[$i]['team'][2] contains the same thing....
but now, I used Code: Code:
$data[$i]['team'] = array_unique($data[$i]['team']);
turns out that
$data[$i]['team'] will only contain ONE array, which is
$data[$i]['team'][0]['id']= 0;
$data[$i]['team'][0]['name']= player0;
and all other arrays are gone...which is not what I wanted...
so what if, I only want to take out the 3rd one because the 3rd one have abosutlutely the same data as the 1st? what code shold I write then?