DomElement->has_attribute() Checks to see if an attribute exists in the current node &reftitle.description; DomElement boolhas_attribute stringname This functions checks to see if an attribute named name exists in the current node. &reftitle.parameters; name The name of the tested attribute. &reftitle.returnvalues; Returns &true; if the asked attribute exists, &false; otherwise. &reftitle.examples; Testing the existence of an attribute document_element(); $buffer = 'has_attribute('language')) { $buffer .= 'lang="' . $root->get_attribute('language') . '"'; } $buffer .= '>'; ?> ]]> Migrating to PHP 5 Use .