How to use array key exists in PHP
In this article, I will explain how the array_key_exists() function can be used in PHP.
array_key_exists() function in PHP
Syntax
array_key_exists(key,array) |
Parameter
Example
The following example show to how the array_key_exists() function can be used in PHP.
<html>
<body>
<h3 style="color: darkseagreen;">array_key_exists() function example in PHP</h3>
<?php
$a=array("a"=>"Nitin","b"=>"Ravi");
if (array_key_exists("a",$a))
{
echo "Array key exists!";
}
else
{
echo "Array key does not exist!";
}
?>
</body>
</html>
|
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here