we have an array we want need to check key(Apple) exists in the array, so we will use array_key_exists() built function of PHP who help to check whether key exists in the array. you can also learn more about array_key_exists() from here.

How To Check key Exist in Array in PHP?

if (array_key_exists("Apple",$a))
  echo "Array Key exists!";
  echo "Array Key does not exist!";


Array Key does not exist!

Note: We have key fruit, car and we are checking Apple in the array, so apple is not existing in array!

Changed status to publish