On 4/22/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
>  How do I append an array of arrays to an array in php.
>
>  If I have -
>  array(0,2,2)
>  or
>  [0,2,2]
>
>  and I have -
>  array(array(1,2,2),array(2,2,2),array(3,2,2))
>  or
>  [[1,2,2]
>  [2,2,2]
>  [3,2,2]]
>
>  How do I append the array of arrays to the array so that I have -
>  array(array(0,2,2),array(1,2,2),array(2,2,2),array(3,2,2))
>  or
>  [[0,2,2]
>  [1,2,2]
>  [2,2,2]
>  [3,2,2]]
>
>  I tried this but it doesn't work
>  $result = $array . $arrays
>
>  Any help would be appreciated.
>  I am obviously doing something wrong!
>

Hi.
You can find many functions for working with arrays here:
http://www.php.net/manual/en/ref.array.php

You can use:
$arrays[] = $array;
which will add the $array to the end of the $arrays, like the
array_push function.
If you want to add it to the beginning use arra_unshift, like this:
array_unshift($arrays, $array);
Which will add the $array to the beginning of $arrays.

regards
mmlado

Reply via email to