Which of these correctly checks whether an array key exists, including when its value is null?
- A isset($arr['key'])
- B array_key_exists('key', $arr)
- C empty($arr['key'])
- D in_array('key', $arr)
Answer
array_key_exists('key', $arr)
isset returns false for a key whose value is null. array_key_exists distinguishes a missing key from a null value.





