Unclassified NewsBoard Code Reference

t2h function

Text-to-HTML conversion

function t2h ($text, $spaces = true, $quotes = true, $nl2br = false, $keepascii = 0);

Parameters:

text
(string) text to encode
spaces  –  optional, default: true
(bool) mask multiple subsequent " " in a way that (almost) no space character gets lost
(with " " -> "  ")
quotes  –  optional, default: true
(bool) replace double quotes with "
nl2br  –  optional, default: false
(bool) replace \n line breaks with <br />
keepascii  –  optional, default: 0
(int) don't replace ASCII codes from 1 to n. can be 7 at most.

Remarks:

Masks special HTML characters: & < >
Unicode-Safe (optional: $unicode): "&#...;" will not be replaced since this is
the alternative description for Unicode characters, by browsers handling Unicode characters
with an ANSI page encoding

Implementation file: unb_lib/common.lib.php, line 1344

© 2006 Yves Goergen. Unclassified NewsBoard Homepage. Reference based on UNB unb.devel.20060128, dated 2006-01-28.