array_diff_assoc Madness... Help?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Good Man

    array_diff_assoc Madness... Help?

    Hi there

    I'm trying to compare two arrays at a time to figure out if data has
    changed, and array_diff_asso c is telling me that there *are differences*
    between:

    Array
    (
    [Floor Common Area] =2878.17
    [3500] =12343.97
    [3550] =3076.52
    [3570] =1631.07
    [3580] =927.34
    [3599] =2791.54
    [Storage for 3500] =80.25
    )
    and:
    Array
    (
    [3500] =12343.97
    [3550] =3076.52
    [3570] =1631.07
    [3580] =927.34
    [3599] =2791.54
    [Floor Common Area] =2878.17
    [Storage For 3500] =80.25
    )

    as well as:

    Array
    (
    [Gross Building Area] =25306.95
    [Vertical Penetrations] =1498.76
    [Floor Common Area] =3104.52
    [3600] =13108.74
    [3663] =7429.54
    [Storage for 3600] =83.27
    )
    and:
    Array
    (
    [3600] =13108.74
    [3663] =7429.54
    [Floor Common Area] =3104.52
    [Gross Building Area] =25306.95
    [Storage For 3600] =83.27
    [Vertical Penetrations] =1498.76
    )

    .... obviously incorrectly. Now, it correctly reports *no differences*
    between:

    Array
    (
    [Gross Building Area] =17128.33
    [Vertical Penetrations] =1253.81
    [Building Common Area] =15061.70
    [Radio Equipment Room] =152.21
    [Spanish Broadcasting] =231.78
    )
    and:
    Array
    (
    [Building Common Area] =15061.70
    [Gross Building Area] =17128.33
    [Radio Equipment Room] =152.21
    [Spanish Broadcasting] =231.78
    [Vertical Penetrations] =1253.81
    )


    I am going crazy trying to figure out why PHP tells me that the top two
    array comparisons are different. This data is part of a larger set, and
    my 'troublesome' comparisons seem to have one thing in common: a key
    called 'Storage for xxxx', where xxxx is a number. So, i'm guessing
    that one xxxx is being interpreted as a string, while the other is being
    interpreted as numeric? It's possible, I guess, as all the arrays are
    being created dynamically... and one is coming from a database.

    Can anyone offer some insight? Do I need to write my own
    array_diff_asso c function?

    Btw, ksort()-ing makes no difference.

    Thanks in advance....

  • Rik

    #2
    Re: array_diff_asso c Madness... Help?

    On Wed, 25 Jul 2007 16:37:31 +0200, Good Man <heyho@letsgo.c omwrote:
    [Storage for 3500] =80.25
    [Storage For 3500] =80.25
    Not the same, are they? (f vs, F)
    --
    Rik Wasmus

    Comment

    • Good Man

      #3
      Re: array_diff_asso c Madness... Help?

      Rik <luiheidsgoeroe @hotmail.comwro te in news:op.tv0ziyh xqnv3q9@metalli um:
      On Wed, 25 Jul 2007 16:37:31 +0200, Good Man <heyho@letsgo.c omwrote:
      > [Storage for 3500] =80.25
      > [Storage For 3500] =80.25
      >
      Not the same, are they? (f vs, F)
      Rik, you made my day. Thanks a bunch. Sometimes a pair of fresh eyes can
      solve the most simple or complex of problems!!!!

      Comment

      Working...