CakeFest 2024: The Official CakePHP Conference

DOMNamedNodeMap::item

(PHP 5, PHP 7, PHP 8)

DOMNamedNodeMap::itemインデックスで指定したノードを取得する

説明

public DOMNamedNodeMap::item(int $index): ?DOMNode

DOMNamedNodeMap オブジェクトから、 index で指定したノードを取得します。

パラメータ

index

マップ内のインデックス。

戻り値

マップ内の index 番目の位置にあるノード、 あるいはインデックスが不正な形式 (マップ内の要素数以上) の場合は null を返します。

add a note

User Contributed Notes 1 note

up
0
reyjacobs at yahoo dot com
16 years ago
Nevermind: I got it, and here it is:

<?php
if($element->hasAttributes())
{
$attributes = $element->attributes;
if(!
is_null($attributes))
{
foreach (
$attributes as $index=>$attr)
{
echo
$attr->name."=\"".$attr->value."\"";
}
}
}
?>
To Top