Php – Conditional SimpleXML possible


I am pulling content from an XML file with SimpleXML.

I was wondering if it is possible to display a certain node depending on the contents of the node, e.g.

    <content>yada yada yada</content>

    <content>yodo yodo yodo</content>

Can SimpleXML find a specific title and then display the article for that title?

Display article whose title is 'PHP'.

I really hope this is possible.

Thanks to anyone who replies.

Best Solution

You could use an XPath expression like //article[title='PHP']/content

Related Question