-
Notifications
You must be signed in to change notification settings - Fork 20
Nodes End
Thomas Weinert edited this page Jul 29, 2014
·
2 revisions
FluentDOM\Nodes end();
Traversing methods like FluentDOM\Nodes::find() return a new instance, but store
the parent instance. FluentDOM\Nodes::end()
returns that parent or itself if it is the top of a chain.
$fd = new FluentDOM\Nodes(
'<items><item/><item/><item/></items>'
);
echo $fd
->find('/items')
->find('item')
->each(
function($node, $index) {
$node['index'] = $index;
}
)
->end()
->each(
function($node, $index) {
$node['length'] = count($node);
}
);
<?xml version="1.0"?>
<items length="3"><item index="0"/><item index="1"/><item index="2"/></items>
- 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