|
Posted by Mara Guida on 12/11/05 19:38
Chameleon wrote:
> ----------------------------------------------
> <?
> $a = array(array(1, 2), array(2, 3), array(4, 5));
> $b = array(6, 7, 8);
>
> foreach($a as & $v)
> $v = array_merge($v, $b);
/* references or no references I don't like to change
* the values that control the foreach() loop.
* I changed your foreach() code and it worked here.
*/
$tmp = array();
foreach($a as $v)
$tmp[] = array_merge($v, $b);
$a = $tmp;
unset($tmp);
>
> var_dump($a);
> foreach($a as $v)
> var_dump($v);
> ?>
> ----------------------------------------------
Navigation:
[Reply to this message]
|