error function php return empty class code example Example 1: php empty object $x = new stdClass(); Example 2: php new stdClass object new stdClass()