(PHP 5, PHP 7, PHP 8) simplexml_load_string — Interprets a string of XML into an object Descriptionsimplexml_load_string( Parametersdata A well-formed XML string class_name You may use this optional parameter so that simplexml_load_string() will return an object of the specified class. That class should extend the SimpleXMLElement class. options Since Libxml 2.6.0, you may also use the namespace_or_prefix Namespace prefix or URI. is_prefix Return Values Returns an object of class SimpleXMLElement with properties containing the data held within the xml document, or Warning This function may return Boolean Errors/Exceptions Produces an ExamplesExample #1 Interpret an XML string
The above example will output: SimpleXMLElement Object ( [title] => Forty What? [from] => Joe [to] => Jane [body] => I know that's the answer -- but what's the question? ) At this point, you can go about using See Also
ascammon at hotmail dot com ¶ 11 years ago
Diego Araos, diego at klapmedia dot com ¶ 11 years ago
rowan dot collins at gmail dot com ¶ 14 years ago
print_r( (string)$xml );
bojan ¶ 14 years ago
print_r($xml);
/* this prints
meustrus ¶ 7 years ago
= <<<XML mindpower ¶ 15 years ago
$xml = simplexml_load_string(' nbijnens at servs dot eu ¶ 15 years ago
amir_abiri at ipcmedia dot com ¶ 14 years ago
$xml->asXml();
hattori at hanso dot com ¶ 15 years ago
javalc6 at gmail dot com ¶ 14 years ago
ia2xml($array) {
jeff at creabilis dot com ¶ 12 years ago
Julio Cesar Oliveira ¶ 13 years ago
artistan at gmail dot com ¶ 7 years ago
AllenJB ¶ 10 years ago
Bob ¶ 13 years ago
Pedro ¶ 15 years ago
cellog at php dot net ¶ 18 years ago
Maciek Ruckgaber <maciekrb at gmai dot com> ¶ 17 years ago
erguven dot m at gmail dot com ¶ 5 years ago
SimpleXMLElement |