# diffAssoc()

{% code title="Example.php" %}

```php
<?php use kim\present\utils\arrays\ArrayUtils;

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

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

{% endcode %}

## Syntax

```php
$arrayUtils->diffAssoc(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

```php
$arrayUtils->diffAssocAs(iterable ...$iterables) : array;
```

```php
ArrayUtils::diffAssocFrom(iterable $from, iterable ...$iterables) : ArrayUtils;
```

```php
ArrayUtils::diffAssocFromAs(iterable $from, iterable ...$iterables) : array;
```

## References

{% embed url="<https://www.php.net/manual/en/function.array-diff-assoc>" %}

{% content-ref url="" %}
[](https://arrayutils.docs.present.kim/methods/c/diff)
{% endcontent-ref %}
