Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Which of these correctly checks whether an array key exists, including when its value is null?

  1. A isset($arr['key'])
  2. B array_key_exists('key', $arr)
  3. C empty($arr['key'])
  4. 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.

All Php MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as