Get array value with unknown key name
Alternatively in my case, I also needed the keyname.
$key = key($array);
$value = $array[$key];
Get the key name from array then use the key to get the value from array.
You can use current()
:
$value = current($array);
or, if you want the key as well, each()
:
list($key, $value) = each($array);