1

array_push($array, getData()) gives me:

Array
(
    [customer] => One
    [itemno] => Yellow Ribbon

)
Array
(
    [customer] => One
    [itemno] => Blue Band
)
Array
(
    [0] => Array
        (
            [customer] => Two
            [itemno] => Red Tape
        )
)

But what I want is:

Array
(
    [customer] => One
    [itemno] => Yellow Ribbon

)
Array
(
    [customer] => One
    [itemno] => Blue Band
)
Array
(
    [customer] => Two
    [itemno] => Red Tape
)

What am I supposed to use?

1
  • 1
    what is the code of getData(), its probably cause it, return an array[0] Commented Aug 15, 2010 at 12:42

2 Answers 2

1

Assuming you're using numeric keys in $array, a simple array_merge($array,getData()) should work, because getData() apparently returns a numeric-indexed multi-dimensional array.

Sign up to request clarification or add additional context in comments.

Comments

0

This will do what you want...

$array[] = getData(); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.