$colsRequired = ["apple", "orange", "banana", "grapes"]; $data = ["apple"=>"some text", "orange"=>"some text"]; $presentInBoth = array_intersect($colsRequired,array_keys($data)); if( count($presentInBoth) != count($colsRequired)) echo "Missing keys :" . join(",",array_diff($colsRequired,$presentInBoth)); else echo "All Required cols are present";
↧
Answer by Ravi Shankar S K for How to check if multiple array keys exists
↧