update page now
PHP 8.1.34 Released!

Dom\Attr::isId

(PHP 8 >= 8.4.0)

Dom\Attr::isId Checks if attribute is a defined ID

Description

public Dom\Attr::isId(): bool

This function checks if the attribute is a defined ID.

According to the DOM standard this requires a DTD which defines the attribute ID to be of type ID. To utilise this method the document must be validated at parse time by passing LIBXML_DTDVALID as an option.

Parameters

This function has no parameters.

Return Values

Returns true if this attribute is a defined ID, false otherwise.

Examples

Example #1 Dom\Attr::isId() Example

<?php

/ We need to validate our document before referring to the id
$doc = Dom\XMLDocument::createFromFile('examples/book-docbook.xml', LIBXML_DTDVALID);

/ We retrieve the attribute named id of the chapter element
$attr = $doc->getElementsByTagName('chapter')->item(0)->getAttributeNode('id');

var_dump($attr->isId()); / bool(true)

?>
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant