1--TEST-- 2DOM Comment : Basic Functionality 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7 8$xml = <<< EOXML 9<?xml version="1.0" encoding="ISO-8859-1"?> 10<courses> 11 <!-- Hello World! --> 12</courses> 13EOXML; 14 15$dom = new DOMDocument(); 16$dom->loadXML($xml); 17$root = $dom->documentElement; 18var_dump($root->hasChildNodes()); 19$children = $root->childNodes; 20 21for ($index = 0; $index < $children->length; $index++) { 22 echo "--- child $index ---\n"; 23 $current = $children->item($index); 24 echo get_class($current), "\n"; 25 var_dump($current->textContent); 26} 27?> 28--EXPECT-- 29bool(true) 30--- child 0 --- 31DOMText 32string(5) " 33 " 34--- child 1 --- 35DOMComment 36string(14) " Hello World! " 37--- child 2 --- 38DOMText 39string(1) " 40" 41