session - PHP: replacing contents of multidimensional Arrays -


we have multi-dimensional array consists of 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 example.

this information stored in session variable example session called variable $_session['a']

i need able change $_session data $_session['a'][0]['sfd'] 10 100

i have tried following code:

$array = $_session['a']; $quantity = 100; $replacements = array('sdf' => $quantity); array_replace($array[0],$replacements); var_dump($array);

but won't work , destroys rest of array aswel, have tried failed can correct mistake or give me helping hand?

i'm not sure if got point looking ?

if (isset($_session['a'][0]['sfd'] ))     $_session['a'][0]['sfd'] =100; 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -