If I had an array like:
$array[\'foo\'] = 400; $array[\'bar\'] = \'xyz\';
And I wanted to get the first item out of that array without knowing
Test if the a variable is an array before getting the first element. When dynamically creating the array if it is set to null you get an error.
For Example:
if(is_array($array)) { reset($array); $first = key($array); }