mirror of
https://github.com/php/php-src.git
synced 2026-03-24 16:22:37 +01:00
For rationale, see #6787 Extensions migrated in part 4: * simplexml * skeleton * soap * spl * sqlite3 * sysvmsg * sysvsem * tidy - also removed a check for an ancient dependency version
23 lines
465 B
PHP
23 lines
465 B
PHP
--TEST--
|
|
SimpleXML [interop]: simplexml_import_dom
|
|
--EXTENSIONS--
|
|
simplexml
|
|
dom
|
|
--FILE--
|
|
<?php
|
|
$dom = new domDocument;
|
|
$dom->load(__DIR__."/book.xml");
|
|
if(!$dom) {
|
|
echo "Error while parsing the document\n";
|
|
exit;
|
|
}
|
|
$s = simplexml_import_dom($dom);
|
|
$books = $s->book;
|
|
foreach ($books as $book) {
|
|
echo "{$book->title} was written by {$book->author}\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
The Grapes of Wrath was written by John Steinbeck
|
|
The Pearl was written by John Steinbeck
|