I know I can set a variable like that $xml->path->to->tag = $newValue . But what if I have only tag name and don’t know its path, I wonder how I can set its variable? is it possible?
I know I can set a variable like that $xml->path->to->tag = $newValue . But
Share
You are looking for
SimpleXml::xpath()– searches the SimpleXML node for children matching the XPath path.The XPath to search for an element anywhere in the XML document is
//elementNameExample XML:
Example PHP Code:
will output (demo)