Skip to content

PossiblyInvalidArrayOffset

An array is accessed with a key that might not exist.

<?php
function get(array $data, string $key): mixed {
return $data[$key]; // $key may not be present in $data
}

Check for the key with array_key_exists() or isset() before accessing it.