HTML entities to normal strings in PHP

Mostafa Dehghani

I have a string with HTML entities in PHP. In html source i can see the html Entities but in the output my string is without html Entities.

like :

HTML source :

<a href="google.com" >Me&nbsp;You</a> ?<!-- output is Me YOU -->

How can i replace &nbsp; with (space) in PHP? (as well as all other HTML entities?)

I want to have this output :

<a href="google.com" >Me You</a> ?<!-- output is Me YOU -->
KIKO Software

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

The function html_entity_decode().

This function decodes all the entities (including all numeric entities) that a) are necessarily valid for the chosen document type — i.e., for XML, this function does not decode named entities that might be defined in some DTD — and b) whose character or characters are in the coded character set associated with the chosen encoding and are permitted in the chosen document type. All other entities are left as is.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related