<?php
weighted_sort(array_flip(supported_types()), priority_types());
function supported_types()
{
static $types = array(
1 => "Terraced House",
2 => "End of terrace house",
3 => "Semi-detached house",
4 => "Detached house",
5 => "Mews house",
6 => "Cluster house",
7 => "Ground floor flat",
8 => "Flat",
9 => "Studio flat",
10 => "Ground floor maisonette",
11 => "Maisonette",
12 => "Bungalow",
13 => "Terraced bungalow",
14 => "Semi-detached bungalow",
15 => "Detached bungalow",
16 => "Mobile home",
20 => "Land",
21 => "Link detached house",
22 => "Town house",
23 => "Cottage",
24 => "Chalet",
26 => "House",
27 => "Villa",
28 => "Apartment",
29 => "Penthouse",
30 => "Finca",
43 => "Barn Conversion",
44 => "Serviced apartment",
45 => "Parking",
46 => "Sheltered Housing",
47 => "Retirement property",
48 => "House share",
49 => "Flat share",
50 => "Park home",
51 => "Garages",
52 => "Farm House",
53 => "Equestrian facility",
56 => "Duplex",
59 => "Triplex",
62 => "Longere",
65 => "Gite",
68 => "Barn",
71 => "Trulli",
74 => "Mill",
77 => "Ruins",
80 => "Restaurant",
83 => "Cafe",
86 => "Mill",
92 => "Castle",
95 => "Village House",
101 => "Cave House",
104 => "Cortijo",
107 => "Farm Land",
110 => "Plot",
113 => "Country House",
116 => "Stone House",
117 => "Caravan",
118 => "Lodge",
119 => "Log Cabin",
120 => "Manor House",
121 => "Stately Home",
125 => "Off-Plan",
128 => "Semi-detached Villa",
131 => "Detached Villa",
134 => "Bar/Nightclub",
137 => "Shop",
140 => "Riad",
141 => "House Boat",
142 => "Hotel Room",
143 => "Block of Apartments",
144 => "Private Halls",
178 => "Office",
181 => "Business Park",
184 => "Serviced Office",
187 => "Retail Property (High Street)",
190 => "Retail Property (Out of Town)",
193 => "Convenience Store",
196 => "Garages",
199 => "Hairdresser/Barber Shop",
202 => "Hotel",
205 => "Petrol Station",
208 => "Post Office",
211 => "Pub",
214 => "Workshop & Retail Space",
217 => "Distribution Warehouse",
220 => "Factory",
223 => "Heavy Industrial",
226 => "Industrial Park",
229 => "Light Industrial",
232 => "Storage",
235 => "Showroom",
238 => "Warehouse",
241 => "Land",
244 => "Commercial Development",
247 => "Industrial Development",
250 => "Residential Development",
253 => "Commercial Property",
256 => "Data Centre",
259 => "Farm",
262 => "Healthcare Facility",
265 => "Marine Property",
268 => "Mixed Use",
271 => "Research & Development Facility",
274 => "Science Park",
277 => "Guest House",
280 => "Hospitality",
283 => "Leisure Facility",
);
return $types;
}
function priority_types()
{
// Types that should take elevated priority.
// This could also be defined in config so that clients can choose a priority
// for items which may help reduce some confusion.
static $priority = array(
"Terraced bungalow" => 2,
"Semi-detached bungalow" => 2,
"Detached bungalow" => 2,
"Studio flat" => 1,
"Equestrian facility" => 1,
"Bungalow" => 1,
"Retirement property" => 1,
"Barn Conversion" => 1,
"Apartment" => 1,
"Garages" => -1
);
return $priority;
}
function weighted_sort(array $input, array $weights)
{
$tmp = array_merge(array(), $input);
do {
$high = array(); $middle = array(); $low = array();
foreach ($tmp as $key => $value) {
if (($hasWeight = isset($weights[$key]))) {
$weight =& $weights[$key];
}
if (!$hasWeight) {
$middle[$key] = $value;
} else if ($weight > 0) {
$high[$key] = $value;
$weight--;
} else if ($weight < 0) {
$low[$key] = $value;
$weight++;
}
if ($hasWeight && $weight === 0) {
unset($weights[$key]);
}
}
$tmp = array();
foreach (array($high, $middle, $low) as $array) {
foreach ($array as $key => $value) {
$tmp[$key] = $value;
}
}
} while (count($weights) > 0);
return $tmp;
}
- Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Output for 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/0m5Lp on line 141
Process exited with code 255. - Output for 4.4.2 - 4.4.9
- Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/0m5Lp on line 141
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
- Parse error: parse error, unexpected T_ARRAY, expecting ')' in /in/0m5Lp on line 141
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/0m5Lp on line 141
Process exited with code 255.
preferences:
270.79 ms | 401 KiB | 347 Q