create object empty php code example Example 1: php empty object $x = new stdClass(); Example 2: php new stdClass object new stdClass()