I am trying to run examples in the php.net but I am getting the error
Fatal error: Call to undefined method SimpleXMLElemen t::addChild()
The example is as follows
$xml = new SimpleXMLElemen t($xmlstr);
$character = $xml->movie[0]->characters->addChild('char acter');
$character->addChild('name ', 'Mr. Parser');
$character->addChild('acto r', 'John Doe');
$rating = $xml->movie[0]->addChild('rati ng', 'PG');
$rating->addAttribute(' type', 'mpaa');
echo $xml->asXML();
Does anyone konw whats going on here?
Fatal error: Call to undefined method SimpleXMLElemen t::addChild()
The example is as follows
$xml = new SimpleXMLElemen t($xmlstr);
$character = $xml->movie[0]->characters->addChild('char acter');
$character->addChild('name ', 'Mr. Parser');
$character->addChild('acto r', 'John Doe');
$rating = $xml->movie[0]->addChild('rati ng', 'PG');
$rating->addAttribute(' type', 'mpaa');
echo $xml->asXML();
Does anyone konw whats going on here?