I have a multi-array stored in a SESSION
I loop through the data in order to change a value which is set to "1" and set it to "0"
But for some reason its not changing it even though it does find the value.
This is what i have:
Array (
[0] => 1
[1] => 0
[2] => admin_user
[8] => 1
[3] => 2
[4] => Array (
[7] => Array (
[0] => User1
[1] => 1
[2] => 1
[3] => w.jpg
[4] => 1
[5] => 1
[6] => 500
[7] => 50
[8] => 3000
)
[1] => Array (
[0] => User2
[1] => 1
[2] => 3
[3] => d.jpg
[4] => 1
[5] => 0
[6] => 200
[7] => 85
[8] => 5000
)
)
)
So in PHP I'm trying to change the value of position 5 in the arrays at position 4.
This is how i did it:
foreach($_SESSION['player_data'][4] as $key){
if($key[5] == 1){
$_SESSION['player_data'][4][$key][5] = 0;
break;
}
}
But it will not set it to 0 it stays as 1 its annoying :( where am i going wrong?