25 August 2023

HTML entities are special codes used to represent characters that have reserved meanings or are difficult to include directly in HTML code. These entities, like & for "&" or < for "<," ensure that text displays correctly in web browsers and avoids potential parsing errors. However, they can make content creation and understanding a bit complex. That's where PHP's html_entity_decode() function comes to the rescue.

Source code viewer
  1. // Decodes all HTML entities (including numerical ones) to regular UTF-8 bytes.
  2. $text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
Programming Language: PHP