Returns an iterative object, not an array definition and usage
The simplexml_load_string () function loads an XML string into the object.
If it fails, it returns false.
Grammar
Simplexml_load_file (String,class,options,ns,is_prefix)
| Parameters |
Description |
| String |
Necessary. Specifies the XML string to use. |
| Class |
Optional. Specifies the class of the new object. |
| Options |
Optional. Specifies the additional Libxml parameters. |
| Ns |
Optional. |
| Is_prefix |
Optional. |
return value
Returns an object of class simplexmlelement that contains the data in an XML document. If it fails, it returns false.
Example
simplexml_load_string($xmlstring); Var_dump ($xml);? >
Output:
Object (SimpleXMLElement) #1 (4) {["to"]=> string (4) "George" ["from"]=> string (4) "John" ["Heading"]=> string (8 "Reminder" ["Body"]=> string "Don ' t forget the meeting!"}
PHP SimpleXML functions
PHP simplexml_load_string () function