[eluser]darkhouse[/eluser]
Why does it have to be multidimensional? What's wrong with doing this?
Code:
foreach ($items as &$item){
$item['distance'] = $this->cfm_lib->getDistance($lat[0]->Lat, $long[0]->Long, $item->Lat, $item->Long);
}
Notice the & in front of $item in the foreach statement. This references each $item so it will affect the $items array. But now you just have one array with a distance value for each element.
Or, if you're using php4 still, you could do this:
Code:
for($i = 0; $i < count($items); $i++){
$items[$i]['distance'] = $this->cfm_lib->getDistance($lat[0]->Lat, $long[0]->Long, $items[$i]->Lat, $items[$i]->Long);
}
Same thing, really. I just prefer the foreach method, it's cleaner.