The example in this article describes the way PHP custom functions convert HTML tags. Share to everyone for your reference, specific as follows:
<?php
/* Created on 2016-9-29
*
*
/$orig = "I ll \" Walk\ "the <b>dog</b> Now";
$a = htmlentities ($orig);
$b = Html_entity_decode ($a);
echo $a; I ' ll "walk" The <b>dog</b> Now
echo $b;//I'll "walk" the <b>dog</b> now
//for users prior to PHP 4.3.0 your may does this:
function Unhtmlentities ($string)
{
//Replace numeric entities
$string = preg_replace (' ~& #x ([ 0-9a-f]+); ~ei ', ' Chr (Hexdec ("\\1")) ', $string);
$string = Preg_replace (' ~&# ([0-9]+); ~e ', ' Chr ("\\1") ', $string);
Replace literal entities
$trans _tbl = get_html_translation_table (html_entities);
$trans _tbl = Array_flip ($trans _tbl);
Return Strtr ($string, $trans _tbl);
$c = unhtmlentities ($a);
Echo $c; I ' ll ' walk ' the <b>dog</b> now
?>
The results of the operation are shown in the following illustration:
For more information about PHP interested readers can view the site topics: "PHP coding and transcoding Operation tips Summary", "PHP object-oriented Programming Introduction Course", "PHP Mathematical Calculation Skills Summary", "PHP Array" Operation Techniques Encyclopedia, "PHP string (String) Usage summary, "PHP Data structure and algorithm tutorial", "PHP Programming Algorithm Summary", "PHP Regular Expression Usage Summary", and "PHP common database Operation skill Summary"
I hope this article will help you with the PHP program design.