<?php
$map = new \Ds\Map(["a", "b", "c", "d", "e"]);
var_dump($map->filter(function($key, $value) {
return $key % 2 == 0;
}));
?>
The above example will output
something similar to:
object(Ds\Map)#3 (3) {
[0]=>
object(Ds\Pair)#2 (2) {
["key"]=>
int(0)
["value"]=>
string(1) "a"
}
[1]=>
object(Ds\Pair)#4 (2) {
["key"]=>
int(2)
["value"]=>
string(1) "c"
}
[2]=>
object(Ds\Pair)#5 (2) {
["key"]=>
int(4)
["value"]=>
string(1) "e"
}
}