<?php
Array("Nome"=>"Rodrigo","CPF"=>"123456789-00","Cargo"=>"Abestado"), Array("Nome"=>"Maria","CPF"=>"987654321-00","Cargo"=>"Abestada") );
Array("CPF"=>"123456789-00","Titulo de Eleitor"=>"456789123"), Array("CPF"=>"987654321-00","Titulo de Eleitor"=>"987564123") );
foreach($array2 as $valor){
$chave = $valor["CPF"];
$arrayChaves[$chave] = $valor;
unset($arrayChaves[$chave]["CPF"]); }
foreach($array1 as $pos => $pessoa){
$cpfPessoa = $pessoa["CPF"];
if (isset($arrayChaves[$cpfPessoa])){ //se o cpf existe no arrayChaves //adiciona a junção dos dois arrays
$array1[$pos] = array_merge($pessoa, $arrayChaves[$cpfPessoa]); }
}
PD9waHAKCiRhcnJheTEgPSBBcnJheSgKICAgIEFycmF5KCJOb21lIj0+IlJvZHJpZ28iLCJDUEYiPT4iMTIzNDU2Nzg5LTAwIiwiQ2FyZ28iPT4iQWJlc3RhZG8iKSwKICAgIEFycmF5KCJOb21lIj0+Ik1hcmlhIiwiQ1BGIj0+Ijk4NzY1NDMyMS0wMCIsIkNhcmdvIj0+IkFiZXN0YWRhIikKKTsKCiRhcnJheTIgPSBBcnJheSgKCUFycmF5KCJDUEYiPT4iMTIzNDU2Nzg5LTAwIiwiVGl0dWxvIGRlIEVsZWl0b3IiPT4iNDU2Nzg5MTIzIiksCglBcnJheSgiQ1BGIj0+Ijk4NzY1NDMyMS0wMCIsIlRpdHVsbyBkZSBFbGVpdG9yIj0+Ijk4NzU2NDEyMyIpCik7CgokYXJyYXlDaGF2ZXMgPSBBcnJheSgpOwpmb3JlYWNoKCRhcnJheTIgYXMgJHZhbG9yKXsKCSRjaGF2ZSA9ICR2YWxvclsiQ1BGIl07CgkkYXJyYXlDaGF2ZXNbJGNoYXZlXSA9ICR2YWxvcjsKCXVuc2V0KCRhcnJheUNoYXZlc1skY2hhdmVdWyJDUEYiXSk7Cn0KCgpmb3JlYWNoKCRhcnJheTEgYXMgJHBvcyA9PiAkcGVzc29hKXs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