SimpleXMLElement_addAttribute_basic.phpt 366 B

123456789101112131415161718192021
  1. --TEST--
  2. SimpleXMLElement->addAttribute()
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. $simple = simplexml_load_file(__DIR__."/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