Checking and changing a value in an array
<p>I have a multi-array stored in a SESSION</p>

<p>I loop through the data in order to change a value which is set to "1" and set it to "0"</p>

<p>But for some reason its not changing it even though it does find the value.</p>

<p>This is what i have:</p>

<pre><code>Array (
    [0] =&gt; 1 
    [1] =&gt; 0 
    [2] =&gt; admin_user
    [8] =&gt; 1 
    [3] =&gt; 2
    [4] =&gt; Array (
        [7] =&gt; Array ( 
            [0] =&gt; User1
            [1] =&gt; 1 
            [2] =&gt; 1 
            [3] =&gt; w.jpg 
            [4] =&gt; 1 
            [5] =&gt; 1 
            [6] =&gt; 500 
            [7] =&gt; 50
            [8] =&gt; 3000 
        )
        [1] =&gt; Array ( 
            [0] =&gt; User2 
            [1] =&gt; 1 
            [2] =&gt; 3 
            [3] =&gt; d.jpg 
            [4] =&gt; 1
            [5] =&gt; 0 
            [6] =&gt; 200 
            [7] =&gt; 85 
            [8] =&gt; 5000
        ) 
    )
)
</code></pre>

<p>So in PHP I'm trying to change the value of position 5 in the arrays at position 4.</p>

<p>This is how i did it:</p>

<pre><code>foreach($_SESSION['player_data'][4] as $key){
    if($key[5] == 1){
       $_SESSION['player_data'][4][$key][5] = 0;
       break;
    }
}
</code></pre>

<p>But it will not set it to 0 it stays as 1 its annoying :( where am i going wrong?</p>
