array_key_first, and the reset() dance it replaces

Getting the first key of an array meant reset() then key(), which moves the internal pointer — so a read had a side effect, and a function given an array by reference could break its caller.

// before
reset($rows);
$first = key($rows);

// 7.3
$first = array_key_first($rows);
$last  = array_key_last($rows);

if ($first === null) {
    // empty. array keys are int|string, so null is unambiguous.
}

Both return null for an empty array, and because array keys can only be integers or strings that is not ambiguous. Neither touches the pointer, which is the real improvement: the old idiom was a mutation dressed as a read. On a codebase still supporting 7.2 the polyfill is three lines, and it is worth adding rather than leaving the reset() in place — the point is the intent, not the microseconds.