1--TEST-- 2Test count nodes in DOMNamedNodeMap 3--CREDITS-- 4Andreas Treichel <gmblar+github@gmail.com> 5--EXTENSIONS-- 6dom 7--FILE-- 8<?php 9 10$document = new DomDocument(); 11$root = $document->createElement('root'); 12$document->appendChild($root); 13for($i = 0; $i < 5; $i++) { 14 $root->setAttribute('attribute-' . $i, 'value-' . $i); 15} 16for($i = 0; $i < 7; $i++) { 17 $item = $document->createElement('item'); 18 $root->appendChild($item); 19} 20var_dump($root->attributes->length); 21var_dump($root->attributes->count()); 22var_dump(count($root->attributes)); 23 24?> 25--EXPECT-- 26int(5) 27int(5) 28int(5) 29