Keys and values
A PHP array is an ordered map: it can represent a sequence or associate keys with values. Define expected keys and distinguish a missing key from a present key with a null value. isset also returns false when the value is null.
Separate computation and effects
A function that calculates a total can return the value without writing to a database. Another layer decides when to persist. This separation makes behavior more predictable and allows reuse in a page, API, or scheduled task.
Guided workplace application
In a partial ticket update, the contract may define that missing owner retains the owner and owner=null clears it. Use array_key_exists to establish whether the key was supplied, then validate value and permission. isset and?? treat null as absence for their purposes and may erase that distinction if used too early. An array is an ordered map with one mapping per key; assigning the same key again replaces its value. Some numeric strings, such as "8", convert to integer keys and may collide with 8. Do not use that conversion implicitly as a business identity rule. When organizing functions, return calculation results and leave notifications and persistence in an explicit layer.
$task = ["owner" => null, "status" => "open"];
$exists = array_key_exists("owner", $task); // true
$isSet = isset($task["owner"]); // falseIn a partial update, omitting the owner field may mean keeping the current value; sending null may mean clearing it. The API contract should distinguish these cases.
Common pitfalls
Confusing absence with null; losing intent through??; overlooking numeric-key conversion.
Related topics: Data with parameters · Security at the web boundary
An absent key and a null value can represent different intentions.
Reference: PHP manual: Arrays · PHP 8.5 reference; DR PHP 2026.2; new fixtures executed on PHP 8.3.17