foreach( $xml->hosts as $host ) { echo "entro<br>"; $valor=$host['label']; echo "valor=".$valor."</br>"; }