Doc #68540 [Com]: Documenattion about checking SimpleXML needs clarification
| From: | Terserah26 at gmail dot com | Date: | Mon, 13 Nov 2017 05:17:25 +0000 |
| Subject: | Doc #68540 [Com]: Documenattion about checking SimpleXML needs clarification | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15231@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68540&edit=1
ID: 68540
Comment by: Terserah26 at gmail dot com
Reported by: seo at gacek dot vot dot pl
Summary: Documenattion about checking SimpleXML needs
clarification
Status: Verified
Type: Documentation Problem
Package: SimpleXML related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Selamat Datang Wahai Pecundang !!!!
Previous Comments:
------------------------------------------------------------------------
[2015-05-27 22:59:12] cmb@php.net
I agree that the wording of the documentation is unfortunate:
| SimpleXML objects created from empty tags
An empty tag would most likely be something like <>. Speaking of
empty elements would be better, but would not take into account
that an empty element may have attributes (not properties), and in
this case casting the respective SimpleXML to bool would also
yield true.
------------------------------------------------------------------------
[2014-12-03 10:47:56] seo at gacek dot vot dot pl
Description:
------------
---
From manual page: http://www.php.net/language.types.boolean
---
Documentation needs some more information, to clarify when simplexml object is considered true.
More information here: http://stackoverflow.com/a/27157104/1430632
Tried adding it to documentation
<warning>
<simpara>
<literal>SimpleXML</literal> evaluates to &true; only if it has child nodes or
properties - only then object is not considered empty.
To check if <literal>SimpleXML</literal> object has &string; value you have to
cast it to &string;
</simpara>
</warning>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68540&edit=1