How to decode html entities (Entity)?

Asked

Viewed 374 times

6

I have a string which returns me from the bank in the following format:

Received by trainee & aacute;rios do project Memória

I would like to convert it to format without the marking and conversions of accents, thus staying:

Received by trainees of the Memory project

Like I should do?

1 answer

4


To remove entities of string:

Just use the function html_entity_decode

$dec = html_entity_decode( 'Recebido por estagiários do projeto Memória' );

If you need to specify a charset, use the third parameter:

html_entity_decode( 'estagiários', ENT_QUOTES, 'UTF-8' );

See working on IDEONE.


More details in the manual:

http://php.net/manual/en/function.html-entity-decode.php


To remove tags of string:

You have the option to remove tags using strip_tags

$dec = strip_tags( 'do <b>projeto<b>' );

See working on IDEONE.


More details in the manual:

http://php.net/manual/en/function.strip-tags.php

Browser other questions tagged

You are not signed in. Login or sign up in order to post.