0
My question is this::
I have 2 arrays:
teste [
id: 20,
campo: nada
etc,
id: 30,
campo: nada
etc,
]
teste 2 [
id: 12,
nome: maria,
etc,
id: 30,
nome: joão,
etc,
]
All the ids will hit, ie, the ids of 1° array are all present in 2° array, but out of order and can’t sort because it comes from a randomly generated JSON.
I need to check when the ids are equal and if yes, create a new key in 1° array with the die of the field nome of 2° array.
I did
foreach ($array1 as $teste) {
if($teste['id']==$array2['id']) {
$array1['nome'] = $array2['nome'];
}
}
It doesn’t work because ids that do not match $array1['nome'] goes blank.
Is there any simple solution?
Perfect Anderson Carlos Woss
 thank you very much
– CaioSchiavo