title: PHP Array - id's unite and sort by year
body: <p>I have array $arr :</p>
  <pre><code>Array ( [0] =&gt; Array ( [id] =&gt; 1 [year] =&gt; 1999 ) [1] =&gt; Array ( [id] =&gt; 1 [year] =&gt; 2022 ) [2] =&gt; Array ( [id] =&gt; 2 [year] =&gt; 2020 ) [3] =&gt; Array ( [id] =&gt; 1 [year] =&gt; 2020 ) )
  </code></pre>
  <p>and I want to unite equal years and sort ids like that:</p>
  <pre><code>&quot;2022&quot; : &quot;1&quot;
  &quot;2020&quot; : &quot;1&quot;, &quot;2&quot;
  &quot;1999&quot; : &quot;1&quot;
  </code></pre>
  <p>How can I do it??? Thanks!</p>