Sort an php array that is part of another array
<p>I have an array like this</p>

<pre><code>"entry a" =&gt; [
    "type": 3,
    "id": 1,
    "content" =&gt; [
        [
            "name" =&gt; "somename a",
            "date": =&gt; "2011-08-2"
        ],
        [
            "name" =&gt; "somename b",
            "date": =&gt; "2012-04-20"
        ],
        [
            "name" =&gt; "somename c",
            "date": =&gt; "2015-01-14"
        ],
    ]
],
 "entry b" =&gt; [
    "type": 3,
    "id": 2,
    "content" =&gt; [
        [
            "name" =&gt; "someothername a",
            "date": =&gt; "2011-01-6"
        ],
        [
            "name" =&gt; "someothername b",
            "date": =&gt; "2015-12-24"
        ],
        [
            "name" =&gt; "someothername c",
            "date": =&gt; "2016-01-01"
        ],
    ]
],
...
</code></pre>

<p>I want to sort just the "content" array, by date, of each entry. I tried the following;</p>

<pre><code>        foreach ($cfArray as $cfEntry) {
            if($cfEntry['type'] == '3' &amp;&amp; !is_null($cfEntry['content'])) {
                $content = $cfEntry['content'];
                uasort($content, function($a, $b) {
                    $a_end = strtotime($a['date']);
                    $b_end = strtotime($b['date']);
                    return ($a_end &gt; $b_end) ? -1 : 1;
                });
                $cfEntry['content'] = $content;
            }
        }
</code></pre>

<p>If I compare $content before and after the sort, it has changed but my $cfArray does not change. Why is that? Is there another way to sort this?</p>