Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,896 questions

51,827 answers

573 users

How to convert all HTML entities from a string to their applicable characters in PHP

1 Answer

0 votes
// string html_entity_decode( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 
//                            [, string $encoding = ini_get("default_charset") ]] )

// ENT_COMPAT    convert only double-quotes 
// ENT_QUOTES    convert both double and single quotes
// ENT_NOQUOTES  don't convert double and single quotes

$s = "I'll \"write\" the <b>php</b> code";

$he = htmlentities($s);

$hed = html_entity_decode($he);

echo $he . "<br />";

echo $hed; 


/*
run:

I'll "write" the <b>php</b> code
I'll "write" the php code

*/

 



answered Jun 28, 2016 by avibootz
edited Jun 28, 2016 by avibootz

Related questions

3 answers 274 views
1 answer 174 views
2 answers 168 views
2 answers 208 views
4 answers 425 views
1 answer 174 views
...