RecursiveArrayIterator::getChildren
現在のエントリが配列あるいはオブジェクトである場合に、そのイテレータを返す
&reftitle.description;
public RecursiveArrayIteratornullRecursiveArrayIterator::getChildren
現在のエントリのイテレータを返します。
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
現在のエントリが配列あるいはオブジェクトである場合に、
そのイテレータを返します。
失敗時に &null; を返します。
&reftitle.errors;
現在のエントリが配列やオブジェクトではない場合に
InvalidArgumentException をスローします。
&reftitle.examples;
RecursiveArrayIterator::getChildren の例
"lemon", "b" => "orange", array("a" => "apple", "p" => "pear"));
$iterator = new RecursiveArrayIterator($fruits);
while ($iterator->valid()) {
if ($iterator->hasChildren()) {
// すべての子を表示します
foreach ($iterator->getChildren() as $key => $value) {
echo $key . ' : ' . $value . "\n";
}
} else {
echo "No children.\n";
}
$iterator->next();
}
?>
]]>
&example.outputs;
&reftitle.seealso;
RecursiveArrayIterator::hasChildren