LMSouq
php-dev Open

PHP check whether property exists in object or class

MI
Micah
1 month ago
3 views
Problem Description
I understand PHP does not have a pure object variable, but I want to check whether a property is in the given object or class. $ob = (object) array('a' => 1, 'b' => 12); or $ob = new stdClass; $ob->a = 1; $ob->b = 2; In **JS,** I can write this to check if variable `a` exists in an object: if ('a' in ob) In **PHP,** can anything like this be done?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base