Skip to content

Instantly share code, notes, and snippets.

@banqhsia
Created August 23, 2019 15:23
Show Gist options
  • Save banqhsia/040846c954138e149489f49af1ed63e1 to your computer and use it in GitHub Desktop.
Save banqhsia/040846c954138e149489f49af1ed63e1 to your computer and use it in GitHub Desktop.
Macros the diff method in case insensitive.
<?php
/**
* Diff the collection with the given items (case insensitive).
*
* @see Collection::diffUsing()
*/
Collection::macro('diffCi', function ($diffBy) {
return $this->diffUsing($diffBy, 'strcasecmp');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment