To check the key is present in an array or not

 <?php

$haystack = array('foo','b','bar');


$target = array('foo', 'bar');


if(count(array_intersect($haystack, $target)) == count($target)){

    echo "present";

}else{

    echo "not present";

}

?>

Comments

Popular posts from this blog

How to seperate character from string in php

How to Delete record using PHP Ajax

Uploads Only 10 files in month step by step