Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

Knowledge base — PHP

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 504

PHP

Finite state machines

Represent a closed state set with an enum and express permitted state/event pairs in match arms.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Function composition

Compose callables by passing the entire return value of the first as the argument of the next.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Functions and parameters

Parameters receive values by default.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

HTTP request and response models

Separate request method and input from response status, headers and body.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Input, output and serialization

A stream has a cursor. After writing JSON to a seekable stream, rewind before reading it back.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Iterators and generators

An iterable may be an array or a Traversable object.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Linear search

Scan values in iteration order until the first equal item.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Loops and iteration

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.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Magic methods

Magic methods connect language operations to an object.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Memory, copies and references

Array assignment uses value semantics and can share storage until a write.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Modules and boundaries

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.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Namespaces and autoloading

A namespace qualifies class names, and use establishes a compile-time alias.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Numeric types

The integer range depends on the platform.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Object model and composition

Composition stores one object inside another and delegates a part of its behavior.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Performance and complexity

Repeated linear membership scans can visit n entries per query.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Program entry point

A CLI invocation starts with the selected script and runs its top-level statements.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Records and aggregates

Represent a record with named, typed constructor-promoted properties.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Recursion and base cases

A recursive call needs a base case and progress toward it.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Reductions and statistics

Reduce a sequence by passing the previous accumulator and the current value to a callback.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Variable scope and lifetime

Local variables ordinarily start afresh on each call.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Security boundaries

Bind data values to parameters in a prepared SQL statement, keeping them separate from query syntax.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Sorting and comparison

A comparison callback must return an integer below zero, zero or above zero.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

SPL iterators and structures

SplQueue is a FIFO collection. enqueue adds at the back and dequeue removes the oldest entry.

Intermediate · PHP 8.4; repository runtime, production runtime not attested
PHP

Strings and text encoding

PHP strings are byte sequences and may contain a zero byte. strlen counts bytes and a string offset selects one byte.

Intermediate · PHP 8.4; repository runtime, production runtime not attested