substitute for assigning with array()?
| From: | David Minor | Date: | Thu, 03 May 2001 01:55:58 +0000 |
| Subject: | substitute for assigning with array()? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-51209@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'.
So I have to change my original code to do direct assignment. !!
definitely is more difficult to read and doesn't look as neat. Is there an
alternative I haven't thought about?
Thanks