<?php
'idApiUm' => 123,
'title' => 'Teste'
),
'idApiDois' => 765,
'title' => 'TÃtulo'
),
'idApiUm' => 632,
'title' => 'Nome'
),
'idApiDois' => 999,
'title' => 'Teste'
),
);
function get_items($array, $field)
{
return $value[$field];
}, $array)
);
}
function get_index($array, $field, $search) {
function ($value) use ($search, $field) {
return (strpos($value[$field], $search) !== false); }
)
);
}
foreach (get_items($arrayTable, 'title') as $value)
{
$array_index = get_index($arrayTable, 'title', $value);
$array_index_item = array(); foreach ($array_index as $i)
{
if (count($array_index_item) == 0) {
$array_index_item = $arrayTable[$i];
}
else
{
$array_index_item = array_merge($array_index_item, $arrayTable[$i]); }
}
$array_new[] = $array_index_item;
}
PD9waHAKCiRhcnJheVRhYmxlID0gYXJyYXkoCiAgIDAgPT4gYXJyYXkoCiAgICAgICdpZEFwaVVtJyA9PiAxMjMsCiAgICAgICd0aXRsZScgID0+ICdUZXN0ZScKICAgKSwKICAgMSA9PiBhcnJheSAoCiAgICAgICdpZEFwaURvaXMnID0+IDc2NSwKICAgICAgJ3RpdGxlJyAgPT4gJ1TDrXR1bG8nCiAgICksCiAgIDIgPT4gYXJyYXkoCiAgICAgICdpZEFwaVVtJyA9PiA2MzIsCiAgICAgICd0aXRsZScgID0+ICdOb21lJwogICApLAogICAzID0+IGFycmF5KAogICAgICAnaWRBcGlEb2lzJyA9PiA5OTksCiAgICAgICd0aXRsZScgID0+ICdUZXN0ZScKICAgKSwKKTsKCmZ1bmN0aW9uIGdldF9pdGVtcygkYXJyYXksICRmaWVsZCkKewogICAgcmV0dXJuIGFycmF5X3VuaXF1ZShhcnJheV9tYXAoZnVuY3Rpb24oJHZhbHVlKSB1c2UgKCRmaWVsZCkgeyAKICAgIAkJcmV0dXJuICR2YWx1ZVskZmllbGRdOyAKICAgIAl9LCAkYXJyYXkpCgkpOwp9CgpmdW5jdGlvbiBnZXRfaW5kZXgoJGFycmF5LCAkZmllbGQsICRzZWFyY2gpIHsKCXJldHVybiBhcnJheV9rZXlz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