Page 1 of 1

Access elements of a multidimensional array for comparison.

Posted: Sat Apr 28, 2007 8:22 am
by facets
Hi All,

Can someone explain to me how to access elements of a multidimensional array?
Here's what my array looks like :

Code: Select all

$date1Range[] = array($date1row['client_id'] => $date1row['total_difference']);
$date2Range[] = array($date2row['client_id'] => $date2row['total_difference']);

Code: Select all

array1 (
  array (
    103 => '116.94',
  )
  array (
    104 => '1467.51',
  )
)

array2 (
  array (
    103 => '116.94',
  )
  array (
    105 => '8400.49',
  )
)
I need to to see if the total_difference for each 'matched' client_id is '<' or '>'.
Here's what I think the pseudo would look like.

if array1.Client_id == array2.Client_id
if array1.Total >= array2.Total
place in new array[]
else
move onto next

Any pointers or suggestion?

tia, Will/.