DOMNamedNodeMap_count.phpt 582 B

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