Re: array_diff odities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 18, 2005 8:03 pm, Pablo Gosse said:
> Howdy folks.  I'm running into something strange with array_diff that
> I'm hoping someone can shed some light on.

If you are running PHP 4.0.4, the manual states that the function was
"broken"...

> I have two tab-delimited text files, and need to find the lines in the
> first that are not in the second, and vice-versa.
>
> There are 794 records in the first, and 724 in the second.
>
> Simple enough, I thought.  The following code should work:
>
> $tmpOriginalGradList = file('/path/to/graduate_list_original.txt');
> $tmpNewGradList = file('/path/to/graduate_list_new.txt');
>
> $diff1 = array_diff($tmpOriginalGradList, $tmpNewGradList);
> $diff2 = array_diff($tmpNewGradList, $tmpOriginalGradList);
>
> I expected that this would set $diff1 to have all elements of
> $tmpOriginalGradList that did not exist in $tmpNewGradList, but it
> actually contains many elements that exist in both.

Exactly what all is *IN* the records?

Phone numbers, addresses, email addresses, birthdates...

Most of which can change from year to year, and then the two records will
not print out the same, eh?

> The same is true for $diff2, in that many of its elements exist in both
> $tmpOriginalGradList and $tmpNewGradList as well.

Give us example data.

We really can't do much without data.

What are the first 10 lines of each file (change their names or whatever)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux