Skip to content

Commit fe5e145

Browse files
committed
docs: Added Set::forEach() documentation
1 parent 6c17e84 commit fe5e145

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/Set.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The Set object holds only unique values of any type.
99
- [`Set::clear()`](#setclear)
1010
- [`Set::delete()`](#setdelete)
1111
- [`Set::entries()`](#setentries)
12+
- [`Set::forEach()`](#setforeach)
1213
- [`Set::has()`](#sethas)
1314
- [`Set::size`](#setsize)
1415

@@ -100,6 +101,18 @@ $iterator->current();
100101
// ['foo', ''foo']
101102
```
102103

104+
### Set::forEach()
105+
106+
The `forEach()` method executes a provided function once per each element of the Set.
107+
108+
```php
109+
$set = new Set([3, 0]);
110+
111+
$set->forEach(function (int $value1, int $value2, Set $set) {
112+
// ...
113+
});
114+
```
115+
103116
### Set::has()
104117

105118
The `has()` method returns `TRUE` when element with the specified value exists in the `Set` or `FALSE` if it does not exist.

0 commit comments

Comments
 (0)