<code lang="php">
$arr = array(
2021 => array(
1 => "1",
2 => "1"
),
2022 => array (
4 => "1",
5 => "1",
6 => "1",
7 => "1"
)
);
asort($arr);
foreach ($arr as $key => $val) {
foreach ($arr[$key] as $key_2 => $val_2) {
echo $key ."-".$key_2."<br>";
}
}
</code>