stdClass in PHP

StuartCreed - Oct 27 '21 - - Dev Community

stdClass is just a generic 'empty' class that's used when casting other types to objects. 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'

Example of use:

$object = new stdClass;
object->status = 'hello'
object->{'3DSecure'} = 'bananas'

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player