Non ho capito se devo utilizzare questa funzione:
xml_entities
presente nel tuo esempio

grazie