The Dom\NamedNodeMap class

(PHP 8 >= 8.4.0)

Introduction

Represents the set of attributes on an element.

Class synopsis

class Dom\NamedNodeMap implements IteratorAggregate, Countable {
/* Properties */
public readonly int $length;
/* Methods */
/* Not documented yet */
}

Properties

length
The number of attributes.

Notes

Note: The DOM extension uses UTF-8 encoding when working with methods or properties. The parser methods auto-detect the encoding or allow the caller to specify an encoding.

add a note

User Contributed Notes 1 note

up
1
cyrille37 at gmail dot com
1 day ago
To access attribute value use getNamedItem() method :
<?php
$imgNode
= $dom->querySelector('figure img');
echo
$imgNode->attributes->getNamedItem('src')->value,"\n";
?>
To Top