For the complete documentation index, see llms.txt. This page is also available as Markdown.

diff()

The diff() method compares with other arrays and returns the values that are not in any of the other arrays

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

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

//General array comparison
$arrayUtils->diff(["first", "4th"]);
// expected output: ["second", "third"]

Syntax

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

Parameter

  • $iterables

    Arrays to compare.

Return value

  • A array containing all the entries that are not present in any of the other arrays. (Keys are preserved)

Prefixing

References

Last updated