ArrayIntersector

When computing many array intersections using the same array, it is more efficient to use array_flip() first and then array_intersect_key(), than array_intersect(). See the discussion at {@link https://stackoverflow.com/questions/6329211/php-array-intersect-efficiency Stack Overflow} for more information.


Description Description

Of course, this is only possible if the arrays contain integer or string values, and either don’t contain duplicates, or that fact that duplicates will be removed does not matter.

This class takes care of the detail.


Source Source

File: vendor/pelago/emogrifier/src/Emogrifier/Utilities/ArrayIntersector.php


			

Top ↑

Methods Methods

  • __construct — Constructs the object with the array that will be reused for many intersection computations.
  • intersectWith — Computes the intersection of `$array` and the array with which this object was constructed.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.