I have read their documentation, but I still don't get when to use each of them and their difference.
Let's consider the situation of having a general string in a variable and needing to echo it inside HTML code. If it has any HTML markup in it, I want it converted to HTML code (<
replaced by <
, &
replaced by &
. If it has UTF special chars that aren't available in HTML code, it's replaced by HTML number (•
replaced by •
).
What's the best function for that?
A harder need: unprintable chars, like \n
, char(10), char(13), etc, be replaced by their number code, in the case the string is printed inside <pre>
or any special textarea so that the string be dumped.