-
Notifications
You must be signed in to change notification settings - Fork 20
Element Countable
Thomas Weinert edited this page Jul 12, 2018
·
3 revisions
FluentDOM\Element
implements the Countable interface. It returns the count of child nodes, or in other words $this->childNodes->length
. Be aware that this
will return whitespace nodes, too.
$xml = <<<'XML'
<items>
<item></item>
<item></item>
<item></item>
</items>
XML;
require_once(__DIR__.'/../../vendor/autoload.php');
$document = new FluentDOM\Document();
$document->preserveWhiteSpace = FALSE;
$document->loadXML($xml);
var_dump(count($document->documentElement));
int(3)
- Home
- Getting Started
- Tasks
- Plugins
- Functions
- Lists
- Creator (5.1)
- CSS Selectors
- Convertors
- Loaders
- Serializers (5.1)
- Transformers (5.1)
- Extended DOM
- XMLReader (6.1)
- XMLWriter (6.1)
- Interfaces