mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-17 13:08:16 +01:00
README: iterator_count()
This commit is contained in:
parent
c8978eb448
commit
ba85214051
@ -63,8 +63,11 @@ foreach ($users as $id => $user) {
|
||||
}
|
||||
```
|
||||
|
||||
Random access like `$users[42]` or counting results like `count($users)` **is not possible** by design.
|
||||
Use above-mentioned `foreach` and find the item or count the collection there.
|
||||
Random access like `$users[42]` is not yet possible.
|
||||
Use above-mentioned `foreach` and find the item or use [JSON Pointer](#parsing-a-subtree).
|
||||
|
||||
Count results via [`iterator_count($users)`](https://www.php.net/manual/en/function.iterator-count.php).
|
||||
Remember it will still have to internally iterate the whole thing to get the count and thus will take about the same time.
|
||||
|
||||
Requires `ext-json` if used out of the box. See [Decoders](#decoders).
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user