Add array_key_first(), array_key_last(), and array_key_index()

Add three new functions:

$key = array_key_first($array [, $value])
$key = array_key_last($array [, $value])
$key = array_key_index($array, $index [, $value])

array_key_first() and array_key_last() respectively return the first and last key in an array, and optionally, the value. array_key_index() returns the key belonging to the zero-based index specified, with the ability to search from the end of the array if a negative index is passed.

These functions do this without mutating the source arrays (so, they do not modify the internal array pointer.)

This allows you to do the equivalent of array_keys($arr)[0] (or foreach($arr as $k => $v) { break; }) with less overhead.