Finite state machines
Represent a closed state set with an enum and express permitted state/event pairs in match arms.
CKTIS / PHP
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Represent a closed state set with an enum and express permitted state/event pairs in match arms.
Compose callables by passing the entire return value of the first as the argument of the next.
Parameters receive values by default.
Separate request method and input from response status, headers and body.
A stream has a cursor. After writing JSON to a seekable stream, rewind before reading it back.
An iterable may be an array or a Traversable object.
Scan values in iteration order until the first equal item.
A foreach loop visits array entries in their current iteration order and can bind both key and value. continue starts the next iteration, while break exits the loop.
Magic methods connect language operations to an object.
Array assignment uses value semantics and can share storage until a write.
A PHP file can act as a module by returning an explicit callable or configuration value. require evaluates that file and yields its returned value.
A namespace qualifies class names, and use establishes a compile-time alias.
The integer range depends on the platform.
Composition stores one object inside another and delegates a part of its behavior.
Repeated linear membership scans can visit n entries per query.
A CLI invocation starts with the selected script and runs its top-level statements.
Represent a record with named, typed constructor-promoted properties.
A recursive call needs a base case and progress toward it.
Reduce a sequence by passing the previous accumulator and the current value to a callback.
Local variables ordinarily start afresh on each call.
Bind data values to parameters in a prepared SQL statement, keeping them separate from query syntax.
A comparison callback must return an integer below zero, zero or above zero.
SplQueue is a FIFO collection. enqueue adds at the back and dequeue removes the oldest entry.
PHP strings are byte sequences and may contain a zero byte. strlen counts bytes and a string offset selects one byte.