this is my sample array data from bio-metrics I just want to collect data that has the same bio_id and date
temp:[
0:{
bio_id:"1"
date:"2017-10-05"
date_time:"2017-10-05 08:00:22"
device_name:"biometrics"
time:"08:00:22"
}
1:{
bio_id:"1"
date:"2017-10-05"
date_time:"2017-10-05 08:00:23"
device_name:"biometrics"
time:"08:00:23"
}
2:{
bio_id:"2"
date:"2017-10-05"
date_time:"2017-10-05 08:06:29"
device_name:"biometrics"
time:"08:06:29"
}
3:{
bio_id:"1"
date:"2017-10-05"
date_time:"2017-10-05 15:06:47"
device_name:"biometrics"
time:"15:06:47"
}
4:{
bio_id:"2"
date:"2017-10-05"
date_time:"2017-10-05 16:01:50"
device_name:"biometrics"
time:"16:01:50"
}
]
I been stuck with this code that I made, and don't know how I should manipulate it, or how I will store it properly, I have try some array function but it gives different result to my data
$len = count($temp);
for ($i=0; $i <$len ; $i++) {
$id = $temp[$i]['bio_id'];
$date = $temp[$i]['date'];
for ($x=0; $x < $len; $x++) {
if ($id == $temp[$x]['bio_id'] && $date == $temp[$x]['date']) {
$data[] = $temp[$x];
$int[] = $x;
}
}
}
I don't know how I should manipulate it, or how I will store it properly, I have try some array function but it gives different result to my data
array_unique()doesn't help. There are no duplicates in the posted array.bio_idanddate. How do you want to store them?