Skip to content

Commit 0bac794

Browse files
committed
docs: Added Map::keys() documentation
1 parent 546f89c commit 0bac794

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/Map.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ primitive values) may be used as either a key or a value.
1010
- [`Map::delete()`](#mapdelete)
1111
- [`Map::get()`](#mapget)
1212
- [`Map::has()`](#maphas)
13+
- [`Map::keys()`](#mapkeys)
1314
- [`Map::set()`](#mapset)
1415
- [`Map::size`](#mapsize)
1516

@@ -98,6 +99,20 @@ $myMap->has('baz');
9899
// false
99100
```
100101

102+
### Map::keys()
103+
104+
The `keys()` method returns a new `MapIterator` instance that contain the keys of each element of the Map.
105+
106+
```php
107+
$myMap = new Map(['foo' => 'bar']);
108+
109+
$iterator = $myMap->keys();
110+
// [object MapIterator]
111+
112+
$iterator->current();
113+
// 'foo'
114+
```
115+
101116
### Map::set()
102117

103118
The `set()` method adds or updates an element in map with a specified key and a value.

0 commit comments

Comments
 (0)