Target encoding is done when PHP passes data to XML handler functions. When an XML parser is created, the target encoding is set to the same as the source encoding, but this may be changed at any point.SimpleXML documentation involves echoing the plot of the first movie, and below example involves echoing the plot of the movie for each movie.
Code:
<?php
//Echo the plot of the first <movie>
echo $parser->document->movie[0]->plot[0]->tagData;
//Echo the plot of each <movie>
foreach($parser->document->movie as $movie)
{
echo $movie->plot[0]->tagData;
}
?>
Bookmarks