Skip to content

Implement Countable for DomNodeList and DOMNamedNodeMap (Request #74837) #2617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Implement Countable for DomNodeList and DOMNamedNodeMap (Request #74837) #2617

wants to merge 3 commits into from

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