Problems with appending values to an array
| From: | Joscha Feth | Date: | Wed, 19 Feb 2003 15:27:22 +0000 |
| Subject: | Problems with appending values to an array | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7887@lists.php.net to get a copy of this message | ||
Hi,
I have a problem appending another values (key => value pairs) to an already
assigned array.
---------------8<------------------
$array1 = array(
"bla" => "foo",
"bar" => "baz"
);
$s->assign("arr",$array1);
$array2 = array(
"fasel" => "blubb",
"foobar" => "foofoo"
);
$s->append("arr",$array2);
---------------8<------------------
Already turns out in (debug console):
-------------------------------------
{$arr} Array (3)
bla => foo
bar => baz
0 => Array (2)
fasel => blubb
foobar => foofoo
But what I need is:
-------------------
{$arr} Array (4)
bla => foo
bar => baz
fasel => blubb
foobar => foofoo
Why does Smarty create a new key there? Seems to be a bug for me, as I
append the values...
append_by_ref results in the same!
Greets,
Joscha