1--TEST--
2SimpleXML [interop]: simplexml_import_dom (new DOM)
3--EXTENSIONS--
4simplexml
5dom
6--FILE--
7<?php
8$dom = Dom\XMLDocument::createFromFile(__DIR__."/book.xml");
9$s = simplexml_import_dom($dom);
10$books = $s->book;
11foreach ($books as $book) {
12    echo "{$book->title} was written by {$book->author}\n";
13}
14
15$s->book[0]->title = "test";
16echo $dom->saveXML();
17
18?>
19--EXPECT--
20The Grapes of Wrath was written by John Steinbeck
21The Pearl was written by John Steinbeck
22<?xml version="1.0" encoding="UTF-8"?>
23<books>
24 <book>
25  <title>test</title>
26  <author>John Steinbeck</author>
27 </book>
28 <book>
29  <title>The Pearl</title>
30  <author>John Steinbeck</author>
31 </book>
32</books>
33