-
Notifications
You must be signed in to change notification settings - Fork 20
Nodes Each
Thomas Weinert edited this page Jul 29, 2014
·
1 revision
void each(callable $function[, callable|bool|NULL $elementsFilter = NULL]);
Calls the provided function for each node in the list. Optionally a filter argument can be provided. If set to TRUE, only element nodes will be affected.
The first argument of the callbacks will be the node, the second argument the index of the node in the list.
$fd = new FluentDOM\Nodes(
'<items><item/><item/><item/></items>'
);
echo $fd
->find('//item')
->each(
function($node, $index) {
$node['index'] = $index;
}
);
<?xml version="1.0"?>
<items><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