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, 04 Jul 2008

view this page in

DomElement->has_attribute()

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

DomElement->has_attribute() — Verifica si un atributo existe en el nodo actual

Descripción

DomElement
bool has_attribute ( string $nombre )

Esta función verifica si un atributo con el nombre dado existe en el nodo actual.

Lista de parámetros

nombre

El nombre del atributo probado.

Valores retornados

Devuelve TRUE si el atributo solicitado existe, FALSE de lo contrario.

Ejemplos

Example #1 Probar la existencia de un atributo

<?php

include("ejemplo.inc");

if (!
$dom domxml_open_mem($cadena_xml)) {
    echo 
"Ocurri&oacute; un error al interpretar el documento\n";
    exit;
}

$raiz $dom->document_element();

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

?>

Migración a PHP 5

Use Material que falta.



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