Php – stdClass in PHP

PHPstdclass

Please define what stdClass is.

Best Answer

stdClass is just a generic 'empty' class that's used when casting other types to objects. Despite what the other two answers say, stdClass is not the base class for objects in PHP. This can be demonstrated fairly easily:

class Foo{}
$foo = new Foo();
echo ($foo instanceof stdClass)?'Y':'N';
// outputs 'N'

I don't believe there's a concept of a base object in PHP