459,287 Members | 1,668 Online Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

 P: n/a Hi there I'm trying to compare two arrays at a time to figure out if data has changed, and array_diff_assoc is telling me that there *are differences* between: Array ( [Floor Common Area] =2878.17  =12343.97  =3076.52  =1631.07  =927.34  =2791.54 [Storage for 3500] =80.25 ) and: Array (  =12343.97  =3076.52  =1631.07  =927.34  =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  =13108.74  =7429.54 [Storage for 3600] =83.27 ) and: Array (  =13108.74  =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_assoc function? Btw, ksort()-ing makes no difference. Thanks in advance.... Jul 25 '07 #1 