We have a multi-dimensional array which consists of the following model:
array( 0 => array('sfa' => 'sfb,'sfb' => 'aaaa,'sfc' => 'bbbb','sfd' => '10','sfe' => 'abc'), 1 => array('sfa' => 'sfb,'sfb' => 'aaaa,'sfc' => 'bbbb','sfd' => '10','sfe' => 'abc'), 2 => array('sfa' => 'sfb,'sfb' => 'aaaa,'sfc' => 'bbbb','sfd' => '10','sfe' => 'abc'), 3 => array('sfa' => 'sfb,'sfb' => 'aaaa,'sfc' => 'bbbb','sfd' => '10','sfe' => 'abc'), )
please note this is an example.
This information is stored in a session variable however for example this session is called a so the variable is $_SESSION['a']
i need to be able to change the $_SESSION data for $_SESSION['a'][0]['sfd'] from 10 to 100
i have already tried the following code:
$array = $_SESSION['a']; $quantity = 100; $replacements = array('sdf' => $quantity); array_replace($array[0],$replacements); var_dump($array);
But it won't work and it destroys the rest of the array aswel, I have tried but failed can anybody correct my mistake or give me a helping hand?