DomElement->has_attribute
(No version information available, might be only in CVS)
DomElement->has_attribute — 現在のノードに属性があるかどうかを調べる
パラメータ
- name
-
検査する属性名
返り値
もし問い合わせた属性が存在する場合 TRUE、そうでない場合 FALSE を返します。
例
例1 属性の存在を調べる
<?php
include("example.inc");
if (!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$root = $dom->document_element();
$buffer = '<html';
if ($root->has_attribute('language')) {
$buffer .= 'lang="' . $root->get_attribute('language') . '"';
}
$buffer .= '>';
?>
PHP 5 への移行
DOMElement::hasAttribute を使用してください。
DomElement->has_attribute
There are no user contributed notes for this page.
