开发者

Empty xml element for future use

开发者 https://www.devze.com 2022-12-15 01:22 出处:网络
If I want to make adding something to an XML file very simple can I do this: <small>$1.99</small>

If I want to make adding something to an XML file very simple can I do this:

<small>$1.99</small>
<medium></med开发者_开发问答ium>
<large>$3.99</large>

Can I leave the medium element blank and tell the php parser to ignore it?

I'm thinking that when I parse it I am going to want all the sizes returned but not a size with no price.


Leaving the field blank is valid xml and it'll be up to your parser to work out what is returned when parsing.


foreach($items as $items)
{ 
    if(! empty($item))
    { 
        //do something
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消