Array_push() takes an array as it's first parameter. In your case you have
an array of arrays (NOT a 2 dimensional array) and to add an element on to
the end of one of them you need to pass the name of the element of the top
level array you want to add an element to into the function.

I.e. if you have
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6);

array_push($fred[1], 7)

will leave
$fred[0] = array(1,2,3);
$fred[1] = array(4,5,6,7);


array_push($fred[0], 7)

will leave
$fred[0] = array(1,2,3,7);
$fred[1] = array(4,5,6);

Tim Ward <> 

        From:  brendan conroy [SMTP:[EMAIL PROTECTED]]
        Sent:  20 February 2002 12:27
        To:  [EMAIL PROTECTED]
        Subject:  novice question --

        Hi, thanks for reading this,
        Iam trying to push elements into a two dimentional array, but I cant
        the proper syntax, I'd be grateful if someone could email me the
        method. Iam using the normal method, which worked fine for a one
        array, but when I use it for a two dimentional array, it doesnt seem
        recognise that is an array, even though I initialized the array with

        $real[0][0] = 0;.

        Thanks a million for your time,


        Get your FREE download of MSN Explorer at

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to