Ds\Map::get() function can return the value for a given key.
public mixed Ds\Map::get( mixed $key [, mixed $default ] )
Ds\Map::get() function can return the value for a given key or an optional default value if the key can't found.
Ds\Map::get() function can return the value mapped to the given key, or the default value is provided and the key can't be found in the map.
Ds\Map::get() function can throw OutOfBoundsException if the key can't be found, and the default value was not provided.
<?php $map = new \Ds\Map([1 => 10, 2 => 20, 3 => 30, 4 => 40, 5 => 50]); var_dump($map->get(1)); var_dump($map->get(2)); var_dump($map->get(4)); var_dump($map->get(6, 60)); ?>
<?php $map = new \Ds\Map(["x" => "Tutorials", "y" => "Point", "z" => "India"]); var_dump($map->get("x")); var_dump($map->get("y")); var_dump($map->get("z")); var_dump($map->get("w", "Tutorix")); ?>