[n]
is also a way to access characters in a string:
$fruits['response']['errormessage']['orange']
==
$fruits['response']['errormessage'][0] // cast to int
==
b (the first character, at position 0) of 'banana'
Use array_key_exists
, possibly in combination with is_array
.