php SimpleXML check if a child exists

后端 未结 16 2160
粉色の甜心
粉色の甜心 2020-11-27 06:24

A->b->c might exist but c might not exist. How do I check it?

16条回答
  •  旧巷少年郎
    2020-11-27 06:58

    The 3 ways I can confirm work in PHP 5.5.23 were using isset() count() or empty()

    Here is a script to show the results from each:

    https://gist.github.com/mchelen/306f4f31f21c02cb0c24

提交回复
热议问题