The following provides only a few simple and commonly used functions. chop removes spaces and get_html_translation_table returns the conversion list to the variable. It defines the HTML-encoded string htmlentities and htmlspecialchars_decode to define a string containing special HTML characters, nl2br quotemeta rtrim.
The following provides only a few simple and commonly used functions. chop removes spaces and get_html_translation_table returns the conversion list to the variable. It defines the html-encoded string htmlentities and htmlspecialchars_decode to define a string containing special html characters, nl2br quotemeta rtrim.
Definition and usage
The chop () function removes white spaces or other predefined characters from the end of a string.
The alias of the rtrim () function of the function.
Syntax
Chop (string, charlist)
*/
$ Str = "I'm a teacher"; // define a string
$ Result = chop ($ str); // you can remove spaces.
Echo $ result; // output result
/*/
Definition and usage
The get_html_translation_table () function returns the translation table used by the htmlentities () and htmlspecialchars () functions.
Syntax
Get_html_translation_table (function, quotestyle)
/*/
$ Trans = get_html_translation_table (html_entities); // return the conversion list to the variable
Print_r ($ trans); // output conversion table
$ Str = "hallo & & Krmer "; // define a string
$ Encoded = strtr ($ str, $ trans); // search for characters
Echo $ encoded; // output result
//
$ Str = "a 'quote' isBold"; // Define a string that includes html Encoding
Echo htmlentities ($ str); // output the processed string
Echo htmlentities ($ str, ent_quotes); // output result after an optional parameter is added
//
$ Str ='
This->"
'; // Define a string containing special html characters
Echo htmlspecialchars_decode ($ str); // output the converted content
Echo"
";
Echo htmlspecialchars_decode ($ str, ent_noquotes); // output results without the quotation marks being encoded
//
$ Str = "cat isn't n dog"; // defines a string containing a linefeed.
$ Result = nl2br ($ str); // perform the conversion operation.
Echo $ result; // output the converted result
//
$ Str = "hello world. (can you hear me ?) "; // Define a string containing metacharacters
$ Result = quotemeta ($ str); // execute the conversion operation
Echo $ result; // output the converted result
//
$ Str = "hello world"; // defines a string with spaces at the end
$ Result = rtrim ($ str); // execute the conversion operation
Echo $ result; // output the converted result
?>