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

search for in the

DomElement::get_elements_by_tagname> <DomElement::get_attribute_node
[edit] Last updated: Fri, 25 May 2012

view this page in

DomElement::get_attribute

(PHP 4 >= 4.1.0)

DomElement::get_attribute Devuelve el valor de el atributo dado

Descripción

string DomElement::get_attribute ( string $name )

Devuelve el valor de el atributo dado en el elemento actual.

Desde PHP 4.3, si no se encuentra un atributo con el name dado, un string vacío es devuelto.

Parámetros

name

El nombre de el atributo. Este parámetro es sensible a mayúsculas y minúsculas.

Valores devueltos

Devuelve el valor de el atributo como un string o un string vacío si no se encuentra un atributo con el name dado.

Ejemplos

Ejemplo #1 Getting the value of an attribute

<?php

include("example.inc");

if (!
$dom domxml_open_mem($xmlstr)) {
    echo 
"Error al analizar el documento\n";
    exit;
}

// obtener el capítulo
$root $dom->document_element();
echo 
$root->get_attribute('language'); // en

?>

Migrating to PHP 5

Use DOMElement::getAttribute.



add a note add a note User Contributed Notes DomElement::get_attribute
There are no user contributed notes for this page.

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