I have an array like this:
[0] => array([location] => [10.1111111,106.2222222];);
[1] => array([location] => [10.1111111,106.2222222];)
[2] => array([location] => [10.3333333,106.444444444];)
[3] => array([location] => [10.1111111,106.2222222];)
[4] => array([location] => [10.3333333,106.444444444];)
I want to keep first array value ( of duplicate values) , and replace all the duplicate value remaining with random number
[0] => array([location] => [10.1111111,106.2222222];)
[1] => array([location] => [10.54545422,106.136633434];)
[2] => array([location] => [10.3333333,106.444444444];)
[3] => array([location] => [10.323123232,106.656565654];)
[4] => array([location] => [10.44342266,106.87878787];)
my code but it's not seem to work:
foreach($dataMap as $items) {
$temp = array();
foreach($items as $value) {
if(!isset($temp[$value])) {
$temp[$value] = '[10.888888,106.999999]';
}
}
$items['location'] = $temp;
}