SimpleXMLElement_addAttribute_basic.phpt 408 B

123456789101112131415161718192021
  1. --TEST--
  2. SimpleXMLElement->addAttribute()
  3. --SKIPIF--
  4. <?php if (!extension_loaded("simplexml")) die("skip"); ?>
  5. --FILE--
  6. <?php
  7. $simple = simplexml_load_file(dirname(__FILE__)."/book.xml");
  8. $simple->addAttribute('type','novels');
  9. var_dump($simple->attributes());
  10. echo "Done";
  11. ?>
  12. --EXPECT--
  13. object(SimpleXMLElement)#2 (1) {
  14. ["@attributes"]=>
  15. array(1) {
  16. ["type"]=>
  17. string(6) "novels"
  18. }
  19. }
  20. Done