diff --git a/reference/simplexml/reference.xml b/reference/simplexml/reference.xml index a7b71e2f07..1969e12d6a 100644 --- a/reference/simplexml/reference.xml +++ b/reference/simplexml/reference.xml @@ -1,5 +1,5 @@ - + @@ -61,6 +61,9 @@ $xmlstr = << + + PHP solves all my web problems + 7 5 @@ -84,6 +87,25 @@ $xml = new SimpleXMLElement($xmlstr); echo $xml->movie[0]->plot; // "So this language. It's like..." ?> +]]> + + + + + Accessing elements within an XML document that contain characters not permitted under + PHP's naming convention (e.g. the hyphen) can be accomplished by encapsulating the + element name within curly braces and the apostrophe. + + Getting <literal><line></literal> + +movie->{'great-lines'}->line;; // "PHP solves all my web problems" +?> ]]> @@ -95,7 +117,8 @@ echo $xml->movie[0]->plot; // "So this language. It's like..." When multiple instances of an element exist as children of a single parent element, normal iteration techniques apply. - +