$html = new DOMDocument(); $html->loadHTML('My Page
$xml = simplexml_load_file('users.xml'); $newUser = $xml->addChild('user'); $newUser->addChild('name', 'John Doe'); $newUser->addChild('email', 'johndoe@example.com'); $newUser->addChild('password', 'password123'); $xml->asXML('users.xml');The appendChild function is a part of the PHP DOM extension and SimpleXML library.