PHP children() fonksiyonu

Tanım ve Kullanım

children() fonksiyonu belirli bir düğümün alt düğümlerini alır.

Gramer

class SimpleXMLElement
{
string children(ns,is_prefix)
}
Parametre Açıklama
ns İsteğe bağlı.
is_prefix İsteğe bağlı.Varsayılan false'dır.

Örnek

XML Dosyası:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>George</to>
<from>John</from>
<heading>Reminder</heading>
<body>Don't forget the meeting!</body>
</note>

PHP Kodu:

<?php
$xml = simplexml_load_file("test.xml");
foreach ($xml->children() as $child)
  {
  echo "Child node: " . $child;
  }
?>

Çıktı benzeri:

Child node: George
Child node: John
Child node: Reminder
Child node: Don't forget the meeting!