array_key_exists(key, search)
array_key_exists(); this function is used to justify key. For the clear concept codes are given below.
<?php
$k = array("car"=>"BMW","pen"=>"Econo","brand"=>"Dell");
if(array_key_exists("car", $k)){
echo "This is a key or index";
}else{
echo "This is not any key";
}
?>
So the basic concept is this function is used for check your given keyword from your defined array that it's key or not. Here inside the first bracket the first argument will be your given keyword which is key. And the second argument will be arrays name which you have defined as variable.
<?php
$k = array("car"=>"BMW","pen"=>"Econo","brand"=>"Dell");
if(array_key_exists("car", $k)){
echo "This is a key or index";
}else{
echo "This is not any key";
}
?>
So the basic concept is this function is used for check your given keyword from your defined array that it's key or not. Here inside the first bracket the first argument will be your given keyword which is key. And the second argument will be arrays name which you have defined as variable.
Comments
Post a Comment