how to define empty object in php code example Example 1: php empty object $x = new stdClass(); Example 2: php new stdClass object new stdClass()