Is there a similar function like in_array() but that can check array keys, instead of values?
Is there a similar function like in_array() but that can check array keys, instead
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on the comment you left on @Alexander Gessler’s answer, here’s a small function you could use:
The function above called
array_keys_existloops through all the keys in the keys array calling PHP’sarray_key_existsfunction and if a key isn’t found the function returns false (or true if all the keys were found in the array).