Title: Warning: array_key_exists() expects parameter 2 to be array
Last modified: September 13, 2020

---

# Warning: array_key_exists() expects parameter 2 to be array

 *  Resolved [haxball100](https://wordpress.org/support/users/haxball100/)
 * (@haxball100)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/)
 * Hello. Sometimes, when I enter my website, I getting this warning:
 * Warning: array_key_exists() expects parameter 2 to be array, string given in /
   home/caauty/domains/camourbeauty.com/public_html/wp-content/plugins/hide-shipping-
   method-for-woocommerce/public/class-woo-hide-shipping-methods-public.php on line
   260
 * My code starts from 260 line:
 *     ```
                   if ( array_key_exists( 'general_rule_match', $cost_rule_match ) ) {
                       $general_rule_match = $cost_rule_match['general_rule_match'];
                   } else {
                       $general_rule_match = 'any';
                   }
   
               } else {
                   $general_rule_match = 'any';
               }
       ```
   
 * How to fix it? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Dotstore](https://wordpress.org/support/users/dots/)
 * (@dots)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/#post-13406564)
 * Hello haxball100,
 * Thanks for reaching out to us.
 * This type of issue might be coming based on the rules type of you have selected.
 * There are two type of rule relation ALL and ANY.
 * [Click here](https://pasteboard.co/Jr9whlD.png) to review the settings.
 * So, can you please update above settings again and let us know your warning get
   removed or not.
 * OR you can change that code to as below:
 *  `if ( array_key_exists( ‘general_rule_match’, (array) $cost_rule_match ) ) {
   
   $general_rule_match = $cost_rule_match[‘general_rule_match’]; } else { $general_rule_match
   = ‘any’; }`
 * Please follow above changes and let us know how it works.
 * Thanks,
 *  Thread Starter [haxball100](https://wordpress.org/support/users/haxball100/)
 * (@haxball100)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/#post-13423619)
 * Hello, thanks for reply!
 * O tryed to change setting, set to ALL, and now is good, I don’t get any warning
   or error. Now just want to know, what does it rule ALL and ANY? Now I changed
   rule settings to ALL, so my system will work same? Thanks!
 *  Plugin Author [Dotstore](https://wordpress.org/support/users/dots/)
 * (@dots)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/#post-13447102)
 * Hello haxball100,
 * Thanks for the update. We are glad to know its working for you. 🙂
 * [Click here](https://docs.thedotstore.com/article/306-how-to-apply-and-or-any-one-condition)
   to review the document for how those both option work.
 * If you have created only one rules then it will works fine on both option.
 * Thanks,
 *  Plugin Author [Dotstore](https://wordpress.org/support/users/dots/)
 * (@dots)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/#post-13472168)
 * Hello haxball100,
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved
 * If you have any further questions, you can start a new thread.
 * Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Warning: array_key_exists() expects parameter 2 to be array’ is closed
to new replies.

 * ![](https://ps.w.org/hide-shipping-method-for-woocommerce/assets/icon-256x256.
   png?rev=3011292)
 * [Hide Shipping Method For WooCommerce](https://wordpress.org/plugins/hide-shipping-method-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hide-shipping-method-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hide-shipping-method-for-woocommerce/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Dotstore](https://wordpress.org/support/users/dots/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/warning-array_key_exists-expects-parameter-2-to-be-array-6/#post-13472168)
 * Status: resolved