array_keys
returns an array of keys. Take the first entry. Alternatively, you could call reset
on the array, and subsequently key
. The latter approach is probably slightly faster (Thoug I didn't test it), but it has the side effect of resetting the internal pointer.