arrayutils
  • Home
  • 📖How to use?
    • âš¡Installation
  • 📖Methods
    • âš¡Static method
      • static from()
      • static of()
      • static mapToArray()
    • âš¡Generic method
      • join()
      • every()
      • some()
      • reduce()
        • reduceRight()
      • sum()
      • pop()
      • shift()
      • includes()
      • keyExists()
      • indexOf()
      • find()
        • findIndex()
      • first()
        • keyFirst()
      • last()
        • keyLast()
      • random()
        • keyRandom()
      • splice()
    • âš¡Chain method
      • chunk()
      • column()
      • combine()
      • concat()
        • concatSoft()
      • countValues()
      • diff()
        • diffAssoc()
        • diffKey()
      • fill()
        • fillKeys()
      • filter()
      • flat()
        • flatMap()
      • flip()
      • forEach()
      • intersect()
        • intersectAssoc()
        • intersectKey()
      • keys()
      • map()
        • mapAssoc()
        • mapKey()
      • pad()
      • push()
      • replace()
      • reverse()
      • slice()
      • sort()
        • sortKey()
      • unique()
      • unshift()
      • values()
  • 📖Suffixes
    • âš¡Suffix - From
    • âš¡Suffix - As
  • links
    • 📌Github repo
    • 📌Packagist project
    • 📌Poggit project
Powered by GitBook
On this page
  • Syntax
  • Parameter
  • Return value
  • Prefixing
  • References
  1. 📖Methods
  2. ⚡Chain method
  3. intersect()

intersectKey()

The intersectKey() method all similar to intersect(), but this applies to keys

Example.php
<?php use kim\present\utils\arrays\ArrayUtils;

$arrayUtils = ArrayUtils::from(["first" => 1, "second" => 2, "third" => 3]);

//General array comparison
$arrayUtils->intersectKey(["first" => 404, "second" => 2]);
// expected output: ["first" => 1, "second" => 2]

Syntax

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

Parameter

  • $iterables

    Arrays to compare.

Return value

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

Prefixing

$arrayUtils->intersectkeyAs(iterable ...$iterables) : array;
ArrayUtils::intersectkeyFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
ArrayUtils::intersectkeyFromAs(iterable $from, iterable ...$iterables) : array;

References

PreviousintersectAssoc()Nextkeys()

Last updated 4 years ago

PHP: array_intersect_assoc - Manual
Logo