PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DomElement->remove_attribute()> <DomElement->get_elements_by_tagname()
Last updated: Fri, 20 Jun 2008

view this page in

DomElement->has_attribute()

(No version information available, might be only in CVS)

DomElement->has_attribute() — Vérifie si un attribut existe

Description

DomElement
bool has_attribute ( string $name )

Cette fonction vérifie l'existence d'un attribut nommé name dans le noeud courant.

Liste de paramètres

name

Le nom de l'attribut testé.

Valeurs de retour

Retourne TRUE si l'attribut demandé existe, FALSE autrement.

Exemples

Exemple #1 Teste l'existence d'un attribut

<?php

include("example.inc");

if (!
$dom domxml_open_mem($xmlstr)) {
    echo 
"Erreur lors de l'analyse du document\n";
    exit;
}

$root $dom->document_element();

$buffer '<html';
if (
$root->has_attribute('language')) {
    
$buffer .= 'lang="' $root->get_attribute('language') . '"';
}
$buffer .= '>';

?>

Migration vers PHP 5

Utilisez DOMElement::hasAttribute.



add a note add a note User Contributed Notes
DomElement->has_attribute()
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites