Website Consultancy and Free Advice

How To Check If XML/SimpleXML Node Exist

PHP Snippet using SimpleXML to check if the XML file has results. This used for a client who need to pull Job XML feeds in and we needed to check if the feed contained valid results.


if (!isset($xml->data->job)) {
    //it's empty
} else {
   // DO SOME FUNKY OUT HERE!
}