Check if the key "Volvo" exists in an array:


SUBMITTED BY: henry1874w

DATE: June 23, 2017, 9:37 p.m.

FORMAT: Text only

SIZE: 164 Bytes

HITS: 324

  1. <?php
  2. $a=array("Volvo"=>"XC90","BMW"=>"X5");
  3. if (array_key_exists("Volvo",$a))
  4. {
  5. echo "Key exists!";
  6. }
  7. else
  8. {
  9. echo "Key does not exist!";
  10. }
  11. ?>

comments powered by Disqus