.. _php-arraykeyexistswithobjects: .. _array\_key\_exists()-works-on-arrays: array_key_exists() Works On Arrays ++++++++++++++++++++++++++++++++++ `array_key_exists() `_ requires arrays as second argument. Until PHP 7.4, objects were also allowed, yet it is now deprecated. .. code-block:: php 1]; var_dump(array_key_exists('a', $array)) // Deprecated since PHP 7.4 $object = new Stdclass(); $object->a = 1; var_dump(array_key_exists('a', $object)) ?> See also `array_key_exists() with objects `_ and `array_key_exists `_. Related PHP errors ------------------- + `0 `_ Connex PHP features ------------------- + `index `_ + `array `_ Suggestions ___________ * Use the (array) cast to turn the object into an array * Use the native PHP function proprety_exists() or isset() on the property to check them. Specs _____ +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Php/ArrayKeyExistsWithObjects | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`CE `, :ref:`Changed Behavior `, :ref:`CompatibilityPHP74 ` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.9.0 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | With PHP 7.4 and older | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+