I have a code that is giving me problems because it is generating errors in execution. I need XML
to convert or replace characters but I do not know how to do this at runtime. I'm trying to do this but to no avail.
<?php
// Receberá todos os dados do XML
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>';
// Raiz do documento XML
$xml .= '<Imobiliaria>';
// Loop dos valores
for ( $i = 0; $i<count($res)-1; $i++ ) {
$xml .= '<Imovel>';
$xml.="<DESCRICAO>".$res[$i]["Descricao"]."</DESCRICAO>";
$xml.= preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $xml);
$xml.= '</Imovel>';
$xml .= '<Imobiliaria>';
?>
I need to know exactly where, how and variables needed in this code to replace or convert characters and eliminate errors in the generation of my XML
, this:
$xml.= preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $xml);