byfareska/array-diff-callable

array_diff like helper with callable support

Installs: 27

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/byfareska/array-diff-callable

v1.0.0 2025-02-25 08:59 UTC

This package is auto-updated.

Last update: 2025-09-27 13:24:23 UTC


README

Compares two arrays like array_diff do but with a custom comparison function.

\Byfareska\Difference\Diff::compare(
    ['foo', 'bar', 'baz'],
    ['foo', 'baz'],
    static fn ($a, $b) => $a === $b
);
// => ['bar']

You can also skip the comparison function to try it compare using built-in comparisons by methods and properties (if exists):

  • getId()
  • id
  • __toString()
  • json_encode for array and stdClass

Installation

composer require byfareska/array-diff-callable