# Dealing with Empty Tags in XML via PHP

**URL:** <https://forum.kirupa.com/t/dealing-with-empty-tags-in-xml-via-php/131604>\
**Category:** Uncategorized\
**Created:** [December 17, 2004, 12:04pm UTC](https://forum.kirupa.com/t/dealing-with-empty-tags-in-xml-via-php/131604 "2004-12-17T12:04:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickeyrush](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@mickeyrush](https://forum.kirupa.com/u/mickeyrush)\
**Post date:** [December 17, 2004, 12:04pm UTC](https://forum.kirupa.com/t/dealing-with-empty-tags-in-xml-via-php/131604/1 "2004-12-17T12:04:29Z")

</div>

Hello,

Wondering if anyone can help me … I’ve been working with the Parsing XML with PHP tutorials and they work great - but i have a question… I don’t know how to get PHP to deal with empty XML tags… ?

I’ve tried various if statements but i cann’t get PHP to recognise that the parsed $data variable is empty! :

function contents($parser, $data){

if(empty($data)){  
echo(“empty + CALL my function”);  
}else{  
echo($data);  
}  
} …if(strlen($data) \> 0) errr " != " …errr == “”…errr

any help would be gratefully received 😉

thanks ,

M
