Modern PHP: types, OOP, Composer, error handling and the runtime model.
Deploy health checks record response times per host. Write
slowHosts(array $durations, float $thresholdMs): array.
$durations maps a host name (a non-numeric string) to a list of
response times in milliseconds (ints).
A monitoring API returns the ids of active sensors, and the frontend
expects a JSON array. Write activeSensorIds(array $sensors): array.
$sensors is a list of ['id' => string, 'status' => string]. Return
the ids of the sensors whose status is exactly "active", in their
A settings loader must tell a missing key apart from a key explicitly
set to null ("explicitly disabled"). Write
configValue(array $config, string $key, mixed $default): mixed:
$key is present in $config, return its value, even when thatWrite groupByCustomer(array $invoices): array for a billing report.
$invoices is a list of ['customer' => string, 'number' => string].
Return a map from customer name to the list of that customer's invoice
numbers. Customers appear in the order they are first seen, and
A support queue shows tickets by priority. Write
sortTickets(array $tickets): array. $tickets is a list of
['id' => string, 'priority' => int, 'opened' => string], where
opened is "YYYY-MM-DD HH:MM". Sort by priority, highest first.
An endpoint returns a list of shipments as JSON. After someone adds
unset($shipments[$i]) to drop cancelled shipments, the mobile app
crashes because the response changed from [...] to
{"0": ..., "2": ...}. Explain what a PHP array really is, why