Returning distinct values from foreach loop in PHP?
Try with:
$property_types = array();
foreach($search_results_unique as $filter_result){
if ( in_array($filter_result['property_type'], $property_types) ) {
continue;
}
$property_types[] = $filter_result['property_type'];
echo $filter_result['property_type'];
}
http://php.net/manual/en/function.array-unique.php
Example:
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
Array
(
[a] => green
[0] => red
[1] => blue
)
You will need to alter it slightly to check using the property_type
part of your array.