Check the key to prevent warnings

Actually this code is throwing some warnings due the key is not present in all the cases. My concern is to verify first if the key is present before to check the value.
I think it is better to use just isset() rather than array_key_exists() in this case