Re: substitute for assigning with array()?

From: Date: Thu, 03 May 2001 06:10:14 +0000
Subject: Re: substitute for assigning with array()?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51218@lists.php.net to get a copy of this message
> I had some code that was working nicely. In it, I was assigning values to > a > multidimensional array like: > > $array_name[0] = array( > key1 => 'val', > key2 => 'val', > key3 => 'val'); > > I added a function that directly assigns vars to the same array like: > > $array_name[0][key4] = 'val'; > > If this function is called prior to the multiple assignment code, it > erases > the directly assigned key/value pair [key4] = 'val'. try : $array_name[0][key4] = 'val4'; $array_name[0]=array_merge( array( key1 => 'val1', key2 => 'val2', key3 => 'val3' ), $array_name[0]); this will work ... michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net

« previous php.general (#51218) next »