Skip to content

Conversation

@blar
Copy link
Contributor

@blar blar commented Jul 9, 2017

Implement the Interface Countable for DomNodeList and DOMNamedNodeMap (Request #74837)

$document = new DomDocument();
$root = $document->createElement('root');
$document->appendChild($root);
for($i = 0; $i < 5; $i++) {
    $root->setAttribute('attribute-' . $i, 'value-' . $i);
}
for($i = 0; $i < 7; $i++) {
    $item = $document->createElement('item');
    $root->appendChild($item);
}

// Count childnodes
var_dump(count($root->childNodes));
var_dump($root->childNodes->count());
var_dump($root->childNodes->length);

// Count attributes
var_dump(count($root->attributes));
var_dump($root->attributes->count());
var_dump($root->attributes->length);

Does this require a RFC?

@blar blar closed this Jul 9, 2017
@blar
Copy link
Contributor Author

blar commented Jul 9, 2017

Contains content of another branch. A clean pull request #2618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant