Home / PHP Tips Generated By ChatGPT / Checking If a Property Exists in an Object in PHP Determine if an object has a specific property with property_exists(). Source Code $obj = (object) ['a' => 'Apple', 'b' => 'Banana']; if (property_exists($obj, 'a')) { echo "Property 'a' exists in the object."; }