Skip to content

Instantly share code, notes, and snippets.

@lagenceoueb
Last active July 18, 2022 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lagenceoueb/246bcd0441620aeac5f8f7f97efdd710 to your computer and use it in GitHub Desktop.
Save lagenceoueb/246bcd0441620aeac5f8f7f97efdd710 to your computer and use it in GitHub Desktop.
Return bordering French area from one area number
<?php
/**
* Return bordering french area from one area number
* Thanks to https://gist.github.com/sunny/13803 for inspiration
*
* @param $areaNumber
* @return mixed
*/
function bordering_areas($areaNumber) {
$borderingAreas = [
'01' => ['38', '39', '69', '71', '73', '74'],
'02' => ['08', '51', '59', '60', '77', '80'],
'03' => ['18', '23', '42', '58', '63', '71'],
'04' => ['05', '06', '13', '26', '83', '84'],
'05' => ['04', '26', '38', '73'],
'06' => ['04', '83'],
'07' => ['26', '30', '38', '42', '43', '48', '84'],
'08' => ['02', '51', '55'],
'09' => ['11', '31', '66'],
'10' => ['21', '51', '52', '77', '89'],
'11' => ['09', '31', '34', '66', '81'],
'12' => ['15', '30', '34', '46', '48', '81', '82'],
'13' => ['04', '30', '83', '84'],
'14' => ['27', '50', '61', '76'],
'15' => ['12', '19', '43', '46', '48', '63'],
'16' => ['17', '24', '79', '86', '87'],
'17' => ['16', '24', '33', '79', '85'],
'18' => ['03', '23', '36', '41', '45', '58'],
'19' => ['15', '23', '24', '46', '63', '87'],
'2A' => ['2B'],
'2B' => ['2A'],
'21' => ['10', '39', '52', '58', '70', '71', '89'],
'22' => ['29', '35', '56'],
'23' => ['03', '18', '19', '36', '63', '87'],
'24' => ['16', '17', '19', '33', '46', '47', '87'],
'25' => ['39', '70', '90'],
'26' => ['04', '05', '07', '38', '84'],
'27' => ['14', '28', '60', '61', '76', '78', '95'],
'28' => ['27', '41', '45', '61', '72', '78', '91'],
'29' => ['22', '56'],
'30' => ['07', '12', '13', '34', '48', '84'],
'31' => ['09', '11', '32', '65', '81', '82'],
'32' => ['31', '40', '47', '64', '65', '82'],
'33' => ['17', '24', '40', '47'],
'34' => ['11', '12', '30', '81'],
'35' => ['22', '44', '49', '50', '53', '56'],
'36' => ['18', '23', '37', '41', '86', '87'],
'37' => ['36', '41', '49', '72', '86'],
'38' => ['01', '05', '07', '26', '42', '69', '73'],
'39' => ['01', '21', '25', '70', '71'],
'40' => ['32', '33', '47', '64'],
'41' => ['18', '28', '36', '37', '45', '72'],
'42' => ['03', '07', '38', '43', '63', '69', '71'],
'43' => ['07', '15', '42', '48', '63'],
'44' => ['35', '49', '56', '85'],
'45' => ['18', '28', '41', '58', '77', '89', '91'],
'46' => ['12', '15', '19', '24', '47', '82'],
'47' => ['24', '32', '33', '40', '46', '82'],
'48' => ['07', '12', '15', '30', '43'],
'49' => ['35', '37', '44', '53', '72', '79', '85', '86'],
'50' => ['14', '35', '53', '61'],
'51' => ['02', '08', '10', '52', '55', '77'],
'52' => ['10', '21', '51', '55', '70', '88'],
'53' => ['35', '49', '50', '61', '72'],
'54' => ['55', '57', '67', '88'],
'55' => ['08', '51', '52', '54', '88'],
'56' => ['22', '29', '35', '44'],
'57' => ['54', '67'],
'58' => ['03', '18', '21', '45', '71', '89'],
'59' => ['02', '62', '80'],
'60' => ['02', '27', '76', '77', '80', '95'],
'61' => ['14', '27', '28', '50', '53', '72'],
'62' => ['59', '80'],
'63' => ['03', '15', '19', '23', '42', '43'],
'64' => ['32', '40', '65'],
'65' => ['31', '32', '64'],
'66' => ['09', '11'],
'67' => ['54', '57', '68', '88'],
'68' => ['67', '88', '90'],
'69' => ['01', '38', '42', '71'],
'70' => ['21', '25', '39', '52', '88', '90'],
'71' => ['01', '03', '21', '39', '42', '58', '69'],
'72' => ['28', '37', '41', '49', '53', '61'],
'73' => ['01', '05', '38', '74'],
'74' => ['01', '73'],
'75' => ['92', '93', '94'],
'76' => ['14', '27', '60', '80'],
'77' => ['02', '10', '45', '51', '60', '89', '91', '93', '94', '95'],
'78' => ['27', '28', '91', '92', '95'],
'79' => ['16', '17', '49', '85', '86'],
'80' => ['02', '59', '60', '62', '76'],
'81' => ['11', '12', '31', '34', '82'],
'82' => ['12', '31', '32', '46', '47', '81'],
'83' => ['04', '06', '13', '84'],
'84' => ['04', '07', '13', '26', '30', '83'],
'85' => ['17', '44', '49', '79'],
'86' => ['16', '36', '37', '49', '79', '87'],
'87' => ['16', '19', '23', '24', '36', '86'],
'88' => ['52', '54', '55', '67', '68', '70', '90'],
'89' => ['10', '21', '45', '58', '77'],
'90' => ['25', '68', '70', '88'],
'91' => ['28', '45', '77', '78', '92', '94'],
'92' => ['75', '78', '91', '93', '94', '95'],
'93' => ['75', '77', '92', '94', '95'],
'94' => ['75', '77', '91', '92', '93'],
'95' => ['27', '60', '77', '78', '92', '93']
];
return $borderingAreas[$areaNumber];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment