profile10.phpt 597 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. SimpleXML [profile]: Accessing two attributes with the same name, but different namespaces
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. error_reporting(E_ALL & ~E_NOTICE);
  8. $root = simplexml_load_string('<?xml version="1.0"?>
  9. <root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
  10. <child reserved:attribute="Sample" special:attribute="Test" />
  11. </root>
  12. ');
  13. $rsattr = $root->child->attributes('reserved-ns');
  14. $spattr = $root->child->attributes('special-ns');
  15. echo $rsattr['attribute'];
  16. echo "\n";
  17. echo $spattr['attribute'];
  18. echo "\n---Done---\n";
  19. ?>
  20. --EXPECT--
  21. Sample
  22. Test
  23. ---Done---