Flow PHP

JsonArrayElements

Read onlyYes
FinalYes

JSON Machine tokenizes a document in PHP, one character class at a time. The elements of a top-level array are found here instead by one PCRE match per element - which runs in C - and decoded by json_decode(), about eight times faster on the orders fixture. Anything this does not recognise goes to JSON Machine.

Methods

__construct()  : mixed
of()  : Generator<mixed, mixed>
$fallback yields the whole document's items through JSON Machine, skipping the given number of leading items - so a scalar element, a malformed element, a missing separator or a document that is not an array yields or refuses exactly what JSON Machine always did, and never repeats an item this already yielded.

Methods

__construct()

public __construct([int<1, max> $chunk = 1 << 20 ]) : mixed
Parameters
$chunk : int<1, max> = 1 << 20

bytes read from the stream per refill

of()

$fallback yields the whole document's items through JSON Machine, skipping the given number of leading items - so a scalar element, a malformed element, a missing separator or a document that is not an array yields or refuses exactly what JSON Machine always did, and never repeats an item this already yielded.

public of(SourceStream $stream, string $first, callable(int): iterable<string|int, mixed> $fallback) : Generator<mixed, mixed>
Parameters
$stream : SourceStream
$first : string

the stream's first bytes, already read at offset 0

$fallback : callable(int): iterable<string|int, mixed>
Return values
Generator<mixed, mixed>
On this page

Search results