源代码:
XML; $elem = new SimpleXMLElement($xml); foreach ($elem as $car) { printf("%s has %d children. ", $car['name'], $car->count()); } ?>
运行结果: