PHP: decoding Html sites

I want to decode html objects using php html_entity_decode (), but my html objects seem to be incompatible with the function.

Example Input String: html_entity_decode('<strong>'); Outputs: <strong> 

Removing 'amp;' solves the problem and creates <strong> , but my file has 'amp;' before each html object. Mass removal amp; will probably solve the problem, but also very destructive for html. Is it possible to convert my objects with this situation into an extra amp; in front of all objects?

+6
source share
1 answer

It is encoded twice - run the html_entity_decode() line html_entity_decode() .

 echo html_entity_decode( html_entity_decode('&amp;lt;strong&amp;gt;')); 

This will be output :

 <strong> 
+15
source

Source: https://habr.com/ru/post/920969/


All Articles