Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Feature/add udiff methods to collection #23107

Conversation

samcrosoft
Copy link
Contributor

The Collection class of the Laravel has a diff method which uses the array_diff php function, sometimes this method isn't sufficient, especially when you need to defined a custom function to indicate different elements in collections.

A case in point is when you wish to do case insensitive difference of two collections. Thankfully, PHP has methods for cases such as this. I have implemented three of such method

  1. udiff (array_udiff)
  2. diffUAssoc (array_diff_uassoc)
  3. diffUKeys (array_diff_ukeys)

the methods are 
1. udiff
2. diffUAssoc
3. diffUKeys
the methods are 
1. udiff
2. diffUAssoc
3. diffUKeys
…samcrosoft/framework into feature/add-udiff-methods-to-collection
@GrahamCampbell GrahamCampbell changed the title Feature/add udiff methods to collection [5.6] Feature/add udiff methods to collection Feb 10, 2018
@taylorotwell
Copy link
Member

Can you come up with better names for the methods? We don't have to copy the underlying PHP function names. Something like diffUsing, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants