R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

PHP Programing language

array_key_exists() Function in PHP
Previous Home Next

array_key_exists()

The array_key_exists() function checks an array for a specified key, and returns true if the key exists and false if the key does not exist.

Syntax:
array_key_exists(key,array)

In above syntax,"key" specifies the key and "array" specifies an array

Example:

<?php
$a=array("Apple"=>"fruit","Mango");
if (array_key_exists("Mango",$a))
   {
   echo "Key exists!";
   }
else
   {
   echo "Key does not exist!";
   }
?>

Output:

Key does not exist!

Previous Home Next