Uname: Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
Software: Apache
PHP version: 5.6.40 [ PHP INFO ] PHP os: Linux
Server Ip: 217.160.0.194
Your Ip: 216.73.217.65
User: u72294154 (9179942) | Group: ftpusers (600)
Safe Mode: OFF
Disable Function:
NONE

name : test.php
<?

$archivos = array(XML_FILE_ASOCIACION);

$total = 0;
$compra = 0;
$total = 0;
$pisos = 0;
$santander = 0;
$tipos = array();
$isf = 0;
$inmuebles = array();
$letras = array();
$certificadoAportado = array();

echo '<h2>Leyendo  inmuebles...........</h2><br />';

foreach ($archivos as $key => $archivo) {

    $xml = new XMLReader();
    $xml->open($archivo);
    $rootElement = 'propiedades';
    $element = 'propiedad';

    while ($xml->read()) {

        if ($xml->localName === $element && $xml->nodeType == XMLReader::ELEMENT) {
            $inmueble = simplexml_load_string($xml->readOuterXml(), 'SimpleXMLElement', LIBXML_NOCDATA);

            $referencia = trim((string) $inmueble->ref);

            if (in_array((string) $inmueble->id, $inmuebles)) {
                continue;
            } else {
                $inmuebles[] = (string) $inmueble->id; // Hacemos cast para no pasar el objeto, solo el valor
                $total++;

                $certificado = trim((string) $inmueble->energiarecibido);
                $tipo = $inmueble->tipo_ofer;
                $ciudad = $inmueble->ciudad;

                if (!in_array($certificado, $certificadoAportado)) {
                    $certificadoAportado[] = $certificado;
                }

                if (!in_array($tipo, $tipos)) {
                    $tipos[] = (string) $tipo;
                }

                if ($tipo == 'Piso') {
                    $pisos++;

                    if ($ciudad == 'Santander') {
                        $santander++;
                    }
                }

                $numagencia = (string) $inmueble->numagencia;

                if ($numagencia == NUM_AGENCIA) {
                    $isf++;
                }
            }
        }
    }
}

echo "<h2>En el XML hay $total inmueble/s de los que $pisos son pisos($santander están Santander) y $isf son de Inmobiliaria San Fernando.</h2><br />";
volcar_variable($tipos);
?>
© 2026 GrazzMean