I have first array:
Array
(
[0] => generala value 1
[1] => specificatii value 1
)
and second array is:
Array
(
[0] => Array
(
[title] => generala title 1
[atribute_cat_id] => 1
[product_id] => 98
)
[1] => Array
(
[title] => specificatii title 1
[atribute_cat_id] => 2
[product_id] => 98
)
)
I want to get this array form:
Array
(
[0] => Array
(
[title] => generala title 1
[atribute_cat_id] => 1
[product_id] => 98
[value] => generala value 1
)
[1] => Array
(
[title] => specificatii title 1
[atribute_cat_id] => 2
[product_id] => 98
[value] => specificatii value 1
)
)
I tried with array_merge but this method put all elements from first array to each element from second array!
Every time both arrays have same number of elements!
Any ideea?
Thank you!
>Solution :
Loop over one of the arrays, using the indexes to access the corresponding element in the other array.
foreach ($first_array AS $i => $value) {
$second_array[$i]['value'] = $value;
}