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

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

$
0
0

One more possible solution:

if (!array_diff(['story', 'message'], array_keys($array))) {    // OK: all the keys are in $array} else {   // FAIL: some keys are not}

Viewing all articles
Browse latest Browse all 22

Trending Articles



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