Compute the current array values which present in the given one.

/**
 * Compute the current array values which present in the given one.
 *
 * @param array $array Array for intersect
 */
public function intersect(array $array): self

Examples

$arrays = Arrays::create(["a" => "green", "red", "blue"])
                ->intersect(["b" => "green", "yellow", "red"])
                ->toArray();

print_r($arrays);

The above example will output:

Array
(
    [a] => green
    [0] => red
)

Getting Started

Methods