arrayutils
Search
K

intersectAssoc()

The intersectAssoc() method all similar to intersect(), but this applies with additional index check
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["first" => 1, "second" => 2, "third" => 3]);
//General array comparison
$arrayUtils->intersectAssoc(["first" => 404, "second" => 2]);
// expected output: ["second" => 2]

Syntax

$arrayUtils->intersectAssoc(iterable ...$iterables) : ArrayUtils;

Parameter

  • $iterables
    Arrays to compare.

Return value

  • A array containing all of the values that intersects with another array.

Prefixing

$arrayUtils->intersectAssocAs(iterable ...$iterables) : array;
ArrayUtils::intersectAssocFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
ArrayUtils::intersectAssocFromAs(iterable $from, iterable ...$iterables) : array;

References