我如何构建一个唯一的数组来检查每个地址字段。
例如,此刻我得到了一切:
$stmnt = "SELECT `location_id`, `location_address1`, `location_address2`,
`location_town`, `location_region`, `location_postcode`
FROM locations WHERE user_id = '{$id}'";
$results = $db->fetchAll($stmnt);
if(!empty($results )) {
foreach($results as $row) {
if($unique){
$value = $row['location_id'];
$label = implode(", ", array(
'address1' => $row['location_address1'],
'address2' => $row['location_address2'],
'town' => $row['location_town'],
'region' => $row['location_region'],
'postcode' => $row['location_postcode']
));
}
我在想,if($unique){
你会在哪里通过搜索这个来检查临时数组中是否存在这个地址1、地址2等?