GoLang Ds\Map::diff

request it (397)
GoLang replacement for PHP's Ds\Map::diff [edit | history]



Do you know a GoLang replacement for PHP's Ds\Map::diff? Write it!

PHP Ds\Map::diff

PHP original manual for Ds\Map::diff [ show | php.net ]

Ds\Map::diff

(PECL ds >= 1.0.0)

Ds\Map::diffCreates a new map using keys that aren't in another map

Description

public Ds\Map Ds\Map::diff ( Ds\Map $map )

Returns the result of removing all keys from the current instance that are present in a given map.

A \ B = {x ∈ A | x ∉ B}

Parameters

map

The map containing the keys to exclude in the resulting map.

Return Values

The result of removing all keys from the current instance that are present in a given map.

See Also

Examples

Example #1 Ds\Map::diff() example

<?php
$a 
= new \Ds\Map(["a" => 1"b" => 2"c" => 3]);
$b = new \Ds\Map(["b" => 4"c" => 5"d" => 6]);

var_dump($a->diff($b));
?>

The above example will output something similar to:

object(Ds\Map)#3 (1) {
  [0]=>
  object(Ds\Pair)#4 (2) {
    ["key"]=>
    string(1) "a"
    ["value"]=>
    int(1)
  }
}