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
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.