Sasha
Sasha

Reputation: 8705

PHP5 - Remove indexes from the array

I have array like this:

array(2) {
    [0]=> array(1) { 
        ["name"]=> string(8) "TestName" 
    } 
    [1]=> array(1) { 
        ["surname"]=> string(6) "iljado" 
    } 
}

and I need it to be like this:

array(2) { 
    ["name"]=> string(8) "TestName" ,
    ["surname"]=> string(6) "iljado" 
}

How can I do this?

Upvotes: 1

Views: 46

Answers (1)

AbraCadaver
AbraCadaver

Reputation: 78994

Recursively merge them:

$array = call_user_func_array('array_merge', $array);

Upvotes: 5

Related Questions