From 41556be35cba41643d18f27c4c9ba264dde6a186 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 12 Apr 2022 11:47:01 +0200 Subject: Commit --- search/dept/data.json/index.php | 76 ++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'search/dept/data.json') diff --git a/search/dept/data.json/index.php b/search/dept/data.json/index.php index 5a0ed2a..fb27645 100644 --- a/search/dept/data.json/index.php +++ b/search/dept/data.json/index.php @@ -1,39 +1,39 @@ - $person) { - if (isset($person["birth"]["place"]) && isset($person["birth"]["place"]["dept"])) { - if (isset($counts[$person["birth"]["place"]["dept"]])) { - $counts[$person["birth"]["place"]["dept"]]++; - } else { - $counts[$person["birth"]["place"]["dept"]] = 1; - } - if (!in_array($person["birth"]["place"]["dept"], $names)) { - $names[] = $person["birth"]["place"]["dept"]; - } - } -} - -foreach ($names as $name) { - $arr[] = [ - 'name' => $name, - 'occurrences' => $counts[$name] . " personne" . ($counts[$name] > 1 ? "s" : "") - ]; -} - + $person) { + if (isset($person["birth"]["place"]) && isset($person["birth"]["place"]["dept"])) { + if (isset($counts[$person["birth"]["place"]["dept"]])) { + $counts[$person["birth"]["place"]["dept"]]++; + } else { + $counts[$person["birth"]["place"]["dept"]] = 1; + } + if (!in_array($person["birth"]["place"]["dept"], $names)) { + $names[] = $person["birth"]["place"]["dept"]; + } + } +} + +foreach ($names as $name) { + $arr[] = [ + 'name' => $name, + 'occurrences' => $counts[$name] . " personne" . ($counts[$name] > 1 ? "s" : "") + ]; +} + echo(json_encode($arr)); \ No newline at end of file -- cgit