Why can't I call property_exists on stdClass?
Because stdClass
does not have any properties. You need to pass in $madeUpObject
:
property_exists($madeUpObject, 'madeUpProperty');
The function's prototype is as follows:
bool property_exists ( mixed $class, string $property )
The $class
parameter must be the "class name or an object of the class". The $property
must be the name of the property.