Quantcast
Channel: How to check if multiple array keys exists - Stack Overflow
Viewing all articles
Browse latest Browse all 22

Answer by iamandrewluca for How to check if multiple array keys exists

$
0
0
$myArray = array('key1' => '', 'key2' => '');$keys = array('key1', 'key2', 'key3');$keyExists = count(array_intersect($keys, array_keys($myArray)));

Will return true, because there are keys from $keys array in $myArray


Viewing all articles
Browse latest Browse all 22

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>