You're losing me hear without sample data, but I'll try.
Ideally your input array would be something like:
$result[] = array('id'=>23, 'text'=>'ok', 'relevance'=>2);
$result[] = array('id'=>42, 'text'=>'joel', 'relevance'=>1);
$result[] = array('id'=>23, 'text'=>'php', 'relevance'=>1);
Which gives
Merlin wrote:
Brent Baisley wrote:
Use the id number as the array key and a simple loop should join
everything together.
for($i=0; $i
$id = $result['id'][$i];
$text = $result['text'][$i];
$relevance = $result['relevance'][$i];
$resultSummary[$id]['id'] = $id;
if ( isset($re
Brent Baisley wrote:
Use the id number as the array key and a simple loop should join
everything together.
for($i=0; $i
$id = $result['id'][$i];
$text = $result['text'][$i];
$relevance = $result['relevance'][$i];
$resultSummary[$id]['id'] = $id;
if ( isset($resultSummary[$
Use the id number as the array key and a simple loop should join
everything together.
for($i=0; $i
$id = $result['id'][$i];
$text = $result['text'][$i];
$relevance = $result['relevance'][$i];
$resultSummary[$id]['id'] = $id;
if ( isset($resultSummary[$id]['text']) ) {
$resultSummary[$id][
Hi there,
I do have a tricky problem with arrays.
There are 3 arrays:
$result[id][]
$result[text][]
$result[relevance][]
Now there might be the case that there are more results with the same $id. I
would like to count all the relevances together for the same id.
For example:
id textrelev
5 matches
Mail list logo