-
Notifications
You must be signed in to change notification settings - Fork 20
Element Countable
Thomas Weinert edited this page Jul 29, 2014
·
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');
$dom = new FluentDOM\Document();
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($xml);
var_dump(count($dom->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